Closed zerongtonywang closed 8 years ago
Shouldn't be particularly hard, if you would like to contribute, I would look for adding the operators to AdvancedFilterQueryForm.OPERATORS
and related tests in test_forms.py
.
For robustness, we may want to implement validation or only show operators for numeric/date fields (see issue #23).
Thanks for replying.
I've been looking through the code base for the past few hours but due to my inexperience with opensource projects I really have no idea where to start.
After adding operator to the dictionary where do i implement the function? A little lost mainly because i dont see model.objects.filter anywhere.
No trouble at all mate. The way the app works is that it creates a django.db.models.Q
object from the given form data, serializes it and stores it in an AdvancedFilter
model instance.
Later, a user selects the filter in the admin, which triggers a call to AdvancedListFilters.queryset
. Which works like other Django admin list filters returning a modified queryset filtered by the query.
I should probably add the above introduction to the documentation if it's missing.
Anyhow, I suggest you look at writing the (failing) test similarly to existing ones in test_forms.py
, with the expected behavior, and then make it pass.
Fixed in #25 , thanks to @pjpassa
is it particularly hard to implement those?