1. Luke Plant
  2. lukeplant_python

Commits

Luke Plant  committed 2f9ac6c

Fixed bugs in reverse generic descriptors used for tagging app.

  • Participants
  • Parent commits a73e5b4
  • Branches default

Comments (0)

Files changed (1)

File django/tagging/fields.py

View file
         self.from_model = from_model
         self.from_attrname = from_attrname
         self.to_attrname = to_attrname
+        self.to_model = to_model
         self.m2m_model = m2m_model
         # Delay getting from_ct and to_ct, because that involves a DB lookup
         # and can cause import errors due to cyclic imports
             raise AttributeError, "Manager must be accessed via instance"
 
         if not hasattr(self, 'from_ct'):
-            self.from_ct = utils.get_content_type_id(from_model)
-            self.to_ct = (to_model == Any) and Any or utils.get_content_type_id(to_model)
+            self.from_ct = utils.get_content_type_id(self.from_model)
+            self.to_ct = (self.to_model is Any) and Any or utils.get_content_type_id(self.to_model)
 
         # Dynamically create a class that subclasses m2m_model's manager
         desc = self # so we can access the descriptor inside the nested class