Ticket #8248: help_fixes_with_foreignkeys_r8521.diff
File help_fixes_with_foreignkeys_r8521.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/db/models/fields/related.py
174 174 175 175 def __get__(self, instance, instance_type=None): 176 176 if instance is None: 177 r aise AttributeError, "%s must be accessed via instance" % self.related.opts.object_name177 return self.related 178 178 179 179 try: 180 180 return getattr(instance, self.cache_name) … … 222 222 223 223 def __get__(self, instance, instance_type=None): 224 224 if instance is None: 225 r aise AttributeError, "%s must be accessed via instance" % self.field.name225 return self.field 226 226 cache_name = self.field.get_cache_name() 227 227 try: 228 228 return getattr(instance, cache_name) … … 286 286 287 287 def __get__(self, instance, instance_type=None): 288 288 if instance is None: 289 r aise AttributeError, "Manager must be accessed via instance"289 return self.related 290 290 291 291 rel_field = self.related.field 292 292 rel_model = self.related.model … … 501 501 502 502 def __get__(self, instance, instance_type=None): 503 503 if instance is None: 504 r aise AttributeError, "Manager must be accessed via instance"504 return self.related 505 505 506 506 # Dynamically create a class that subclasses the related 507 507 # model's default manager. … … 546 546 547 547 def __get__(self, instance, instance_type=None): 548 548 if instance is None: 549 r aise AttributeError, "Manager must be accessed via instance"549 return self.field 550 550 551 551 # Dynamically create a class that subclasses the related 552 552 # model's default manager.