On Sun, Mar 6, 2011 at 6:57 PM, Gergely <[email protected]> wrote:
> Hello,
> I'm trying to find an answer to an old question that is why I'm
> forwarding this old message.
> I tried to find the documentation of this change but couldn't.
> Could you please help me?
> I would like to find out:
> - why is only one foreign key generated in the intermediary join
> table?
> - can I influence the sql generation to have both foreign keys
> (without specifying my own join table) ?
You don't show us you models and the generated SQL so
I doubt anybody can help you here, please also include the
information requested below for your second question.
>
> There is a similar behaviour at simple foreign keys:
> If you define the referenced model later and use "lazy" relationship
> in the foreign key field (with the name of the model instead of the
> model itself) than in the generated sql you will not find the
> "REFERENCES" part of the foreign key definition.
> Example:
>
> Model:
> class Book(models.Model):
> publisher = models.ForeignKey("Publisher")
>
> class Publisher(models.Model):
>
> Generated sql:
> CREATE TABLE "books_book" (
> "id" integer NOT NULL PRIMARY KEY,
> "publisher_id" integer NOT NULL,
> )
What database engine are you using? What version of Django?
--
Ramiro Morales
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.