django-expense / expense /

#from django.db import models
from django.contrib.admin.filterspecs import DateFieldFilterSpec
from django.utils.translation import ugettext as _
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.encoding import iri_to_uri
from django.conf import settings

class ExpenseDateFilterSpec(DateFieldFilterSpec):
    A custom filter spec for the date field.

    It list all the available months, years of the Expenses objects.

    def __init__(self, f, request, params, model, model_admin,

        super(ExpenseDateFilterSpec, self).__init__(f, request, params, model,

        self.links = [(_('Any date'), {}),]

        months = model.objects.get_months()
        for m in months:
                (m.strftime("%Y. %B"),
                 {'%s__year' % str(m.year),
                  '%s__month' % str(m.month)}))

        years = model.objects.get_years()
        for y in years:
                (y.strftime("%Y. total"),
                 {'%s__year' % str(y.year)}))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.