Sunday, May 8, 2011

Django-misc

And hi there again,

There are django-misc application, that I want to talk about.
First, I developed it with my friend - Vlad Frolov. We started to working on it couple years ago.
It was like a part of every project, we've done since than. We always used misc/ app as place, where all "strange", "not know were to put" code were placed.
And recently I published it on GitHub, and to PyPi (it was my first experience - and it turned out pretty easy).
So if you want latest version:
pip install git+git://github.com/ilblackdragon/django-misc.git
and stable version:
pip install django-misc

If you want to use bbcodes - install postmarkup, and if you want html clearer (remove javascript, iframes, etc - make html safe) - install BeautifulSoup.

After installation, you can add it to INSTALLED_APPS if you want template tags and management commands:
INSTALLED_APPS = (
   ...
   'misc',
   ...
)

From this I'll got:

  •  template tags misc_tags, bbcode_tags, html_tags, share_buttons
  • command - create_app - that will create application in apps/ folder
  • post_sync event that will create Site object from settings.SITE_NAME and SITE.DOMAIN
  • Middlewares: SpacelessMiddleware that removes spaces from response html; StripCookieMiddleware - remove google analytics cookies (to enable django cache for full page).
Plus I'll have (even without adding to INSTALLED_APPS):
  • json_encode.py : json_encode, json_response and json_template functions
  • views.py : server_error, redirect_by_name
  • decorators.py: to_template (render_to), receiver (standard on django 1.3)
  • utils.py: HttpResponseReload,  custom_spaceless, render_bbcode, strip_bbcode, str_to_class, get_alphabets (russian and english)
  • html clearer: html.clear.clear_html_code

This application still under development, so we'll add more functionality later. But it already have plenty a lot of cool stuff, so I add this application on all projects I create.
On full documentation I'll work later.

No comments:

Post a Comment