Ticket #18002: attr-fix.diff

File attr-fix.diff, 652 bytes (added by ptone, 3 years ago)
  • django/db/models/fields/related.py

    diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
    index e23c7dc..a431258 100644
    a b class ReverseSingleRelatedObjectDescriptor(object): 
    353353
    354354    def __set__(self, instance, value):
    355355        if instance is None:
    356             raise AttributeError("%s must be accessed via instance" % self._field.name)
     356            raise AttributeError("%s must be accessed via instance" % self.field.name)
    357357
    358358        # If null=True, we can assign null here, but otherwise the value needs
    359359        # to be an instance of the related class.
Back to Top