Django-filter is a reusable Django application I have been working on for a few weeks, individuals who follow me on Github may have noticed me working on it. Django-filter is basically an application that creates a generic interface for creating pages like the Django admin changelist page. It has support for defining vairous filters(including custom ones), filtering a queryset based on the user selections, and displaying an HTML form for the filter options. It has a design based around Django's ModelForm.
You can get the code, as well as tests and docs over at Github. For all bug reports, comments, and other feedback you can send me a message on Github(or message me on IRC) until I figure out a proper bug tracking system.
Enjoy.
Subscribe to:
Post Comments (Atom)
Yay, I was just dreaming about something like that! hehe.
ReplyDeletekudos for Alex, time for django.contrib.filters ? ;)))
Good work. I also made an app like this, but it's still in test phase. It's also based in ModelForm, but has some differences. Latelly I can show you.
ReplyDeleteI have been using something for filters since a long time too, but your solution looks a lot cleaner.
ReplyDeleteI will definitely try this out.
Great app, Alex!
ReplyDeleteThanks Alex,
ReplyDeleteI really like using you app!
Is it true that (Positive)IntegerFields are not supported yet?
Many thanks!
This is a very useful app. Thank you!
ReplyDeleteRan into a problem with 'ModelMultipleChoiceFilter'.
class WorkListFilter(FilterSet):
status = ModelMultipleChoiceFilter()
class Meta:
model = Work
fields = ['status']
('status' is a foreignkey to another model)
File "/Site/user/views.py", line 27, in WorkListFilter
status = ModelMultipleChoiceFilter()
File "/Site/filter/filters.py", line 38, in __init__
self.field = self.field(required=False, label=label, widget=widget, **kwargs)
TypeError: __init__() takes at least 2 non-keyword arguments (1 given)
any ideas?
Michael, please file a bug at github and I'll look into it.
ReplyDeleteMichael, you should define queryset:
ReplyDeletestatus = ModelMultipleChoiceFilter(queryset=...)
Boris, thank you, that works!
ReplyDeleteAlex, thanks for your continued work on this great django-app.. very much appreciated!
Hi Alex,
ReplyDeleteI happened to not notice your announcement and started working in the same direction almost simultaneously, but much slower and at first without a clear vision of the results. At this point your code seems to be much better thought-out and more complete.
I'll consider switching to your application.
Thanks for this excellent work! :-)
Hello,
ReplyDeleteI created something similar but more close to the Admin Filters. Actually I just subclassed the Admin Changelist. So it uses the options defined for the ModelAdmin class. It also provides template tags for inserting filter html. It uses GET variables directly through links rather than a form.