- Timestamp:
- 04/18/08 18:53:24 (9 months ago)
- Files:
-
- django/branches/newforms-admin (modified) (1 prop)
- django/branches/newforms-admin/django/contrib/contenttypes/generic.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin
- Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7377 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7435
django/branches/newforms-admin/django/contrib/contenttypes/generic.py
r7233 r7436 36 36 37 37 def instance_pre_init(self, signal, sender, args, kwargs): 38 # Handle initalizing an object with the generic FK instaed of 39 # content-type/object-id fields. 38 """ 39 Handles initializing an object with the generic FK instaed of 40 content-type/object-id fields. 41 """ 40 42 if self.name in kwargs: 41 43 value = kwargs.pop(self.name) … … 44 46 45 47 def get_content_type(self, obj=None, id=None): 46 # Convenience function using get_model avoids a circular import when using this model 48 # Convenience function using get_model avoids a circular import when 49 # using this model 47 50 ContentType = get_model("contenttypes", "contenttype") 48 51 if obj: … … 62 65 except AttributeError: 63 66 rel_obj = None 64 67 65 68 # Make sure to use ContentType.objects.get_for_id() to ensure that 66 69 # lookups are cached (see ticket #5570). This takes more code than 67 # the naive ``getattr(instance, self.ct_field)``, but has better 70 # the naive ``getattr(instance, self.ct_field)``, but has better 68 71 # performance when dealing with GFKs in loops and such. 69 72 f = self.model._meta.get_field(self.ct_field)
