Skip to content

Commit

Permalink
Bugfix: check m2m only if the current field is a m2m
Browse files Browse the repository at this point in the history
  • Loading branch information
jedie committed May 9, 2012
1 parent 74a1159 commit c8e0429
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions reversion_compare/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ def __eq__(self, other):
if self.value != other.value:
return False

many_to_many_data1 = self.get_many_to_many()
many_to_many_data2 = other.get_many_to_many()
if many_to_many_data1 != many_to_many_data2:
return False
if self.field.get_internal_type() == "ManyToManyField": # FIXME!
many_to_many_data1 = self.get_many_to_many()
many_to_many_data2 = other.get_many_to_many()
if many_to_many_data1 != many_to_many_data2:
return False

return True

Expand All @@ -92,6 +93,8 @@ def get_many_to_many(self):
"""
returns a queryset with all many2many objects
"""
if self.field.get_internal_type() != "ManyToManyField": # FIXME!
return
many_related_manager = self.get_related()
if many_related_manager:
# XXX: work-a-round to get all objects, see: https://github.com/etianen/django-reversion/issues/153
Expand Down

0 comments on commit c8e0429

Please sign in to comment.