[Django] #21212: OneToOneField reference does not document the "reverse" name

5 views
Skip to first unread message

Django

unread,
Oct 2, 2013, 5:12:42 PM10/2/13
to django-...@googlegroups.com
#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.

Django

unread,
Oct 3, 2013, 10:30:54 AM10/3/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_tests: => 0
* version: 1.5 => master
* easy: 0 => 1
* needs_docs: => 0
* stage: Unreviewed => Accepted


Comment:

The reverse attribute is just `<othermodel>` (lowercased). We can also
mention the name can be customized with `related_name` (just like
`ForeignKey`).

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:1>

Django

unread,
Oct 3, 2013, 12:28:51 PM10/3/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by charettes):

#21216 is fixing an issue with hidden `OneToOneField` reverse descriptor
that should unify `related_name` across all related fields.

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:2>

Django

unread,
Oct 18, 2013, 11:26:18 AM10/18/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0

Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/1774 PR] (needs some improvements).

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:3>

Django

unread,
Oct 18, 2013, 11:58:00 AM10/18/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: schacki
Type: | Status: assigned

Cleanup/optimization | Version: master
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by schacki):

* owner: nobody => schacki
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:4>

Django

unread,
Oct 18, 2013, 4:22:31 PM10/18/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: schacki
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Documentation | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"f8632572ad84b05256423841cee6335490ba0698"]:
{{{
#!CommitTicketReference repository=""
revision="f8632572ad84b05256423841cee6335490ba0698"
Fixed #21212 -- Documented the reverse name for OneToOneField.

Thanks bjb at credil.org for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:5>

Django

unread,
Oct 18, 2013, 4:23:06 PM10/18/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: schacki
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Documentation | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"f198abc7e4f0ac4b2d7e1aa6e860ffb2e491810a"]:
{{{
#!CommitTicketReference repository=""
revision="f198abc7e4f0ac4b2d7e1aa6e860ffb2e491810a"
[1.6.x] Fixed #21212 -- Documented the reverse name for OneToOneField.

Thanks bjb at credil.org for the report.

Backport of f8632572ad from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:6>

Django

unread,
Oct 18, 2013, 4:23:07 PM10/18/13
to django-...@googlegroups.com
#21212: OneToOneField reference does not document the "reverse" name
-------------------------------------+-------------------------------------
Reporter: bjb@… | Owner: schacki
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Documentation | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: OneToOneField, | Needs documentation: 0
reverse | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"8ffa99ccb6173e6dd53a83204933d99a9a6748a3"]:
{{{
#!CommitTicketReference repository=""
revision="8ffa99ccb6173e6dd53a83204933d99a9a6748a3"
[1.5.x] Fixed #21212 -- Documented the reverse name for OneToOneField.

Thanks bjb at credil.org for the report.

Backport of f8632572ad from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21212#comment:7>

Reply all
Reply to author
Forward
0 new messages