Package: redsolutioncms.django-utilities
A set of Django useful utilities.ImageField with preview in admin interfaceOverride allows to create users with dot in usernameLocalized date filterConsoleException middlewareInstallation:Pututilitiesin to yourINSTALLED_APPSin yoursettings.pywithin your django project.Usage:ImagePreviewField:Used to show image preview near ImageField.To use it in yourmodels.pyfrom utilities.fields import ImagePreviewFieldd

class MyModel(models.Model):
        image = ImagePreviewField(upload_to='upload/')You can specify maximum width and height for the thumbclass MyModel(models.Model):
        image = ImagePreviewField(upload_to='upload/', thumb_size=(80, 80))If you have separated field with thumb for this image you can specify its name and told to use its real size:class MyModel(models.Model):
        thumb = models.ImageField(upload_to='thumb/')
        image = ImagePreviewField(upload_to='upload/', thumb_field='thumb', thumb_size=None)Dot is username:By default this application will allow you to create users in admin with dot in there names.
To disallow setALLOW_DOT_IS_USERNAMEtoFalsein yoursettings.py.Local date template filter:Thedate_localfilter supposed to be used with Django 1.1 (1.2+ already has such feature ).
Load filter with{% load utilities_tags %}and use it like dateDjango date filterFor example:{{ entry.creation_date|date_local:"d F Y" }}Returns 01 Января 2010 forrulocaleConsoleException middleware:Often you get annoyed when Django show Tracebacks likeFile "/home/mysite/django-mysite3/django/template/__init__.py", line
800, in render_node
return node.render(context)ConsoleException middleware prints original tracebacks in STDOUT. It is very helpful
for debugging sometimes.
Use itONLYin development mode!Reset password form:To enable password reset form, set in yoursettings.py:ENABLE_PASSWORD_RESET = TrueAnd include utilities urls into your urlconf:urlpatterns += patterns('',
    (r'^', include('utilities.urls')),
)You will get  link to password reset in users administration section under email
field.
When you reset password to some user,  all his or her active sessions will be
deleted, password will be set to unusable.
The only way to login is follow link, provided in email.
If user has no email, you will not able reset password for this user.SplitDateField:You can specify minimal and maximum date with attributesfrom_date(defaultdatetime.date(1930,01,01)) andtill_date(defaultdatetime.date.today)
, they must have date type or be callable object. Also you may reverse order of
years with help of boolean attributereverse(default False).Iffrom_date=datetime.date(2007,01,01),till_date=datetime.date(2010,01,01)andreverse=False, then we obtain the sequence of years: 2007, 2008, 2009, 2010To use it in yourmodels.pyfrom utilities.fields import SplitDateField

  class MyModel(models.Model):
    date = SplitDateField(from_date=datetime.date(2008,10,01),
      till_date=datetime.date.today, reverse=True)To use  it in yourforms.pyfrom utilities.fields import SplitDateFormField

  class MyForm(forms.Form)
    date = SplitDateFormField(from_date=datetime.date(2008,10,01),
      till_date=datetime.date.today, reverse=True)Management commands:Since 0.1.4 few management commands added:imagekit_recacheRe-create cache for imagekit models. Command has –force option to delete old cache dir.update_permissionsUpdate permissions for installed models. Useful if you change permissions in project’s lifecycle.AJAX CRSF:Django CSRF protection (https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax) documentationoffer solution to set CSRF headers to ajax requests on site. That solution copied into utulities
script to avoid copy-paste.:<script type="text/javascript" src="{{ STATIC_URL }}utilities/js/csrf.js" />Classifiers:UtilitiesHistory:0.1.0 (2010-11-04)Initial release0.1.1 (2010-11-15)Aded reset password form0.1.2 (2010-11-16)Bugfixes indate_localtemplate filterFixed compabilityResetPasswordFormin Django 1.10.1.3 (2010-11-23)AddSplitDateField0.1.4 (2012-02-01)Added management commands, wrapped ImagePreviewField IOError0.1.5Added Django’s CSRF ajax script