Commits

Luke Plant committed 602d410

Fixed bug introduced into ForeignKeyFilter remove links

  • Participants
  • Parent commits 9f65da0

Comments (0)

Files changed (2)

File django_easyfilters/filters.py

                                     params=None)]
         return choices
 
-    def get_choices(self, qs):
-        choices_remove = self.get_choices_remove(qs)
-        if len(choices_remove) > 0:
-            return choices_remove
-        else:
-            choices_add = self.normalize_add_choices(self.get_choices_add(qs))
-            return self.sort_choices(qs, choices_add)
-
-    def get_choices_add(self, qs):
-        raise NotImplementedError()
+class DrillDownMixin(object):
 
     def get_choices_remove(self, qs):
         chosen = self.chosen
             obj = self.rel_model.objects.get(**lookup)
         except self.rel_model.DoesNotExist:
             return None
-        return unicode(None)
+        return unicode(obj)
 
     def get_choices_add(self, qs):
         count_dict = self.get_values_counts(qs)

File django_easyfilters/tests/filterset.py

         # Should have one item
         self.assertEqual(1, len(choices2))
         self.assertEqual(choices2[0].link_type, FILTER_REMOVE)
+        self.assertEqual(choices2[0].label, choice.label)
 
         # 'Clicking' should remove filtering
         filter3 = ForeignKeyFilter('genre', Book, choices2[0].params)