Changes between Initial Version and Version 29 of Ticket #10227


Ignore:
Timestamp:
Jun 6, 2014, 10:40:16 AM (10 years ago)
Author:
Aymeric Augustin
Comment:

Replying to akaariai:

The example of related_default usage is exactly what I am afraid. That code contains a serious pitfall: the user.profile isn't saved, and it will not be associated to the user if you don't save it. And, you do get that default value even for saved user instances.

This was (probably) fixed by #10811.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10227

    • Property Milestone post-1.0
    • Property Triage Stage UnreviewedAccepted
    • Property Cc eallik@… olau@… django@… Sebastian Goll Aymeric Augustin cvrebert Francis Devereux mike@… added
    • Property Version 1.0SVN
    • Property SeverityNormal
    • Property TypeNew feature
    • Property Easy pickings unset
    • Property Has patch unset
    • Property UI/UX unset
    • Property Summary OneToOne fields with null=True raise DoesNotExist exception on related modelSupport a related_default on OneToOne fields
  • Ticket #10227 – Description

    initial v29  
     1EDIT: scroll to comment 13 to see what this ticket is about.
     2
     3
    14Referencing a {{{OneToOneField}}} with {{{null=True}}} (i.e. it's optional) when there is no value set will return {{{None}}}, as expected.
    25However, referencing the reverse side of the relation does not follow this behavior and raises a {{{DoesNotExist}}} exception.
Back to Top