Ticket #2145: djt-2145-one_to_one_field-contribution.diff

File djt-2145-one_to_one_field-contribution.diff, 958 bytes (added by Jeremy Dunck <jdunck@…>, 18 years ago)

Contribute to restaurant, not place.

  • django/db/models/fields/related.py

     
    613613        super(OneToOneField, self).contribute_to_class(cls, name)
    614614        setattr(cls, self.name, ReverseSingleRelatedObjectDescriptor(self))
    615615
    616     def contribute_to_related_class(self, cls, related):
    617         setattr(cls, related.get_accessor_name(), SingleRelatedObjectDescriptor(related))
    618616        if not cls._meta.one_to_one_field:
    619617            cls._meta.one_to_one_field = self
    620618
     619    def contribute_to_related_class(self, cls, related):
     620        setattr(cls, related.get_accessor_name(), SingleRelatedObjectDescriptor(related))
     621
     622
    621623    def formfield(self, **kwargs):
    622624        defaults = {'form_class': forms.ModelChoiceField, 'queryset': self.rel.to._default_manager.all()}
    623625        defaults.update(kwargs)
Back to Top