GithubHelp home page GithubHelp logo

risent / django-datefilterspec Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tzulberti/django-datefilterspec

0.0 1.0 0.0 324 KB

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

Home Page: http://coolchevy.org.ua

django-datefilterspec's Introduction

django-daterange-filter

Add the option to filter by a custom date range on the admin. This allows to inputs to be used to get the custom date range filters.

See datefilter.png of a screenshot of how this is seen on the admin.

IMPORTANT: this will work with Django 1.4. I won't work with previous Django versions.

Installation

Use pip/easy_install

pip install django-daterange-filter

Add daterange_filter to settings.INSTALLED_APP. For this, edit the setup.py file:

INSTALLED_APPS = (
    ...
    'daterange_filter'
)

After this, if you have a model like this one:

class MyModel(models.Model):
    ...
    foo = models.CharField(max_length=1, choices=BAR_CHOICES)
    created_at = models.DateField()

To allow to filter the created_at field using the date ranges, you must edit the admin.ModelAdmin referenced to that class:

from daterange_filter.filter import DateRangeFilter
from django.contrib import admin
from models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    list_filter = (
        'foo',
        ('created', DateRangeFilter), # this is a tuple
        ...
    )

DateRangeFilter honours localization and supports local date formats for filtering.

Changes

0.2.0:

  • Updated README
  • Works with DateTime (special thanks to Andrea Rabbaglietti)

0.1.1:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.