1. Luke Plant
  2. django-easyfilters


Luke Plant  committed 495bd73

Fixed bug with ManyToMany erroring with invalid query param

  • Participants
  • Parent commits 8656fb9
  • Branches default

Comments (0)

Files changed (2)

File django_easyfilters/filters.py

View file
  • Ignore whitespace
                              None, # Don't need count for removing
-                for choice in chosen]
+                for choice in chosen if choice in obj_dict]
 class DrillDownMixin(object):

File django_easyfilters/tests/filterset.py

View file
  • Ignore whitespace
                           (unicode(anne), FILTER_REMOVE),
                           (unicode(charlotte), FILTER_ADD)])
+    def test_manytomany_filter_invalid_query(self):
+        self.do_invalid_query_param_test(lambda params:
+                                             ManyToManyFilter('authors', Book, params),
+                                         MultiValueDict({'authors':['xxx']}))
+        self.do_missing_related_object_test(lambda params:
+                                                ManyToManyFilter('authors', Book, params),
+                                            MultiValueDict({'authors':['10000']}))
     def test_datetime_filter_multiple_year_choices(self):
         Tests that DateTimeFilter can produce choices spanning a set of years