Changeset 7764
- Timestamp:
- 06/26/08 05:50:25 (2 months ago)
- Files:
-
- django/trunk/django/db/models/options.py (modified) (1 diff)
- django/trunk/tests/regressiontests/queries/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/options.py
r7600 r7764 275 275 Initialises the field name -> field object mapping. 276 276 """ 277 cache = dict([(f.name, (f, m, True, False)) for f, m in 278 self.get_fields_with_model()]) 279 for f, model in self.get_m2m_with_model(): 280 cache[f.name] = (f, model, True, True) 277 cache = {} 278 # We intentionally handle related m2m objects first so that symmetrical 279 # m2m accessor names can be overridden, if necessary. 281 280 for f, model in self.get_all_related_m2m_objects_with_model(): 282 281 cache[f.field.related_query_name()] = (f, model, False, True) 283 282 for f, model in self.get_all_related_objects_with_model(): 284 283 cache[f.field.related_query_name()] = (f, model, False, False) 284 for f, model in self.get_m2m_with_model(): 285 cache[f.name] = (f, model, True, True) 286 for f, model in self.get_fields_with_model(): 287 cache[f.name] = (f, model, True, False) 285 288 if self.order_with_respect_to: 286 289 cache['_order'] = OrderWrt(), None, True, False django/trunk/tests/regressiontests/queries/models.py
r7761 r7764 90 90 def __unicode__(self): 91 91 return unicode(self.num) 92 93 # Symmetrical m2m field with a normal field using the reverse accesor name 94 # ("valid"). 95 class Valid(models.Model): 96 valid = models.CharField(max_length=10) 97 parent = models.ManyToManyField('self') 98 99 class Meta: 100 ordering = ['valid'] 92 101 93 102 # Some funky cross-linked models for testing a couple of infinite recursion … … 769 778 5 770 779 780 Bug #7107 -- this shouldn't create an infinite loop. 781 >>> Valid.objects.all() 782 [] 783 771 784 """} 772 785
