Ticket #2145: djt-2145-one_to_one_field-contribution.diff
File djt-2145-one_to_one_field-contribution.diff, 958 bytes (added by , 18 years ago) |
---|
-
django/db/models/fields/related.py
613 613 super(OneToOneField, self).contribute_to_class(cls, name) 614 614 setattr(cls, self.name, ReverseSingleRelatedObjectDescriptor(self)) 615 615 616 def contribute_to_related_class(self, cls, related):617 setattr(cls, related.get_accessor_name(), SingleRelatedObjectDescriptor(related))618 616 if not cls._meta.one_to_one_field: 619 617 cls._meta.one_to_one_field = self 620 618 619 def contribute_to_related_class(self, cls, related): 620 setattr(cls, related.get_accessor_name(), SingleRelatedObjectDescriptor(related)) 621 622 621 623 def formfield(self, **kwargs): 622 624 defaults = {'form_class': forms.ModelChoiceField, 'queryset': self.rel.to._default_manager.all()} 623 625 defaults.update(kwargs)