#25749: Cannot use foreign keys between tables of the same non-default db
-------------------------------+--------------------
     Reporter:  muraveill      |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.8
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 When one has multiple databases, one can use the `using` keyword (or a
 router class) to query or save entries to a specific db.
 Cross-database references (foreign keys) are not supported, but nothing
 should prevent one from using references between tables of the _same_ db.
 But it does not work:

     person = People(firstname=firstname, lastname=lastname)
     person.save(using=MY_DB)

     newuser = User(username=username, person=person)
     newuser.save(using=MY_DB)   # to illustrate, but it fails at the
 previous line

 returns

     Cannot assign "<People: People object>": "People" instance isn't saved
 in the database.

 Using a router class telling models User and People to always use MY_DB,
 instead of the 'using' keyword, does not help.
 At least there is a point missing in the documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/25749>
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/052.08210412d0a96d202a23673746b73076%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to