Django admin filter by ranges of dates with calendar

Adds filtering by ranges of dates in the admin filter sidebar.

class DateFilterSpec(DateFieldFilterSpec):
    """
    """

    def __init__(self, f, request, params, model, model_admin):
        super(DateFilterSpec, self).__init__(f, request, params, model,
                                                   model_admin)
        self.field_generic = '%s__' % self.field.name

    def title(self):
        title = super(DateFilterSpec, self).title()
        form = DateForm(initial=self.params)
        out =  u"""
            <style>
                .calendarbox {
                    /*left:0 !important;*/
                    z-index:1100;
            }
            </style>
            <form method="GET" action="">
            <link rel="stylesheet" type="text/css" href="%(admin_media)scss/forms.css" />
            <link rel="stylesheet" type="text/css" href="%(admin_media)scss/widgets.css" />
            %(form_media)s
            <ul>
            %(form)s
            <li> <input type="submit" value="%(search)s"> </li>
            </ul>
            </form>
        """ % {'search':_('Go'),'form_media':form.media,'form':form.as_ul(),'admin_media':settings.ADMIN_MEDIA_PREFIX}
        return mark_safe(title) + mark_safe(out)

https://github.com/coolchevy/django-datefilterspec




coded by nessus