Permalink
Browse files

Bugfix: check m2m only if the current field is a m2m

  • Loading branch information...
1 parent 74a1159 commit c8e042945a6e78e5540b6ae27666f9b0cfc94880 @jedie committed May 9, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 reversion_compare/admin.py
View
@@ -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
@@ -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

0 comments on commit c8e0429

Please sign in to comment.