#30537: ORM: ForeignKey: inconsistent handling of referenced obj. id
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  AliakseiMi                         |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  2.0
  layer (models, ORM)                |       Keywords:  ORM, ForeignKey,
               Severity:  Normal     |  NOT NULL constraint, inconsistency
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 In short: if referenced obj. is saved after attaching to a referencing
 obj. its id field (i.e. ''<refrerenced_obj>''_id) there remains None.

 In details:


 {{{
 class ReferencedObj(Model):
     ...

 class ReferencingObj(Model):

     referenced_obj = ForeignKey(ReferencedObj)
     ...

 x = ReferencedObj()
 y = ReferencingObj()

 y.referenced_obj = x

 x.save()

 y.save() -----→ NOT NULL constraint failed:
 ..._referencingobj.referenced_obj_id
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30537>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.c13cadddfdcf8f9655392ccfffbdb52b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to