Greetings,

I would like to reference a model in another database.  I see that the
TODO list on MultipleDatabaseSupport in the code wiki has the
following:

  When validating models, warn user if a model references
  another model that is configured to use a different connection  DONE

I started this post to request help understanding why that would be a
problem, but the process of composing this email made me focus on the
question and come of with an answer.  Now it seems kind of silly that
it was a question, but I was trying to refactor my applicatio with the
multiple-db-support.

I'm going to go ahead and post this with my answer in case someone
else has the same desire to reference a model in another database.
Feel free to comment or not.

Question:  Why can't I reference a model in another database?
Answer: The first database cannot maintain referential integrity with
another database.  It does not know how to connect to another database
to ensure integrity is kept.  So how do I do it?  Business logic.
First, have the one model keeps a reference to the primary key of the
model in the other database.  Second, ensure that the view takes care
of the logic to create, update and delete the data using information
from both databases.

Thanks for helping me figure this out.  ;-)

Carlos Hanson


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to