#21212: OneToOneField reference does not document the "reverse" name --------------------------------------+------------------------------------ Reporter: bjb@… | Owner: nobody Type: Cleanup/optimization | Status: new Component: Documentation | Version: 1.5 Severity: Normal | Keywords: OneToOneField, reverse Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------ https://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
Says OneToOneField is like ForeignKey, and does not name the reverse attribute. ForeignKey states that the reverse attribute is called <othermodel>_set and can refer to multiple models. The OneToOneField documentation says the reverse attribute returns a single object, but doesn't say what the reverse name is (surely not <othermodel>_set? - but if not that, then what?) This is true for 1.5 and dev documentation - probably true for other versions as well. It would also be nice it if explicitly stated that an instance of the other model can exist without having an instance of the model that refers to it with OneToOneField. Eg, if you have: Place Restaurant place = OneToOneField (Place) Then you can have a place record without a Restaurant record, but you cannot have a Restaurant record without a Place record. This is alluded to in the Place/Restaurant example elsewhere https://docs.djangoproject.com/en/dev/topics/db/examples/one_to_one/, but could be stated in the OneToOneField documentation. This may be related to #10227. But until any change are implemented, I'm for documenting the actual behaviour. -- Ticket URL: <https://code.djangoproject.com/ticket/21212> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/057.69cf052c51cbe5547fb8f928e94fea89%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.