Ok, it is clear now.
SQLite unfortunatelly does not support "ALTER TABLE ADD CONSTRAINT"
command.
So the "REFERENCES" clause is not possible if the referenced table is
missing, there is no alter, and of course django will not re-arrange
my definition order.
The same applies to many-to-many relation
Thanks a lot Tom!
Now I see that not the "REFERENCES" is missing but the "ALTER" at the
end of the script.
And of course the reason is clear, you are right.
I will test it with the latest django and sqlite and report the result
here.
Regards,
Gergely
On márc. 7, 13:33, Tom Evans wrote:
> On Mo
On Mon, Mar 7, 2011 at 12:04 PM, Tom Evans wrote:
> If so, then there is no difference in the SQL generated - why would there be?
>
> Cheers
>
> Tom
>
Oh, I'm waay wrong:
class Series(models.Model):
pass
class Episode(models.Model):
series = models.ForeignKey('Series')
=>
BEGIN;
CREATE TA
On Mon, Mar 7, 2011 at 11:08 AM, Gergely wrote:
> And if you change the order?
> If the foreign key references a model defined later?
>
> Gergely
>
Do you mean:
class Episode(models.Model):
series = models.ForeignKey('Series')
class Series(models.Model):
pass
instead of:
class
> And if you change the order?
> If the foreign key references a model defined later?
Correct me if I'm wrong, but you can't do that -- python will
complain.
I can't find a better reference off the bat than
http://docs.djangoproject.com/en/1.2/ref/django-admin/#inspectdb
It says that you have to r
And if you change the order?
If the foreign key references a model defined later?
Gergely
On márc. 7, 11:40, Tom Evans wrote:
> On Mon, Mar 7, 2011 at 10:04 AM, Gergely wrote:
> > Ok, lets concentrate 1 question at a time.
>
> > If you define the referenced model later and use "lazy" relationsh
On Mon, Mar 7, 2011 at 10:04 AM, Gergely wrote:
> Ok, lets concentrate 1 question at a time.
>
> 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 th
Ok, lets concentrate 1 question at a time.
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.
DB engi
On Sun, Mar 6, 2011 at 6:57 PM, Gergely 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 for
ooks_book" (
"id" integer NOT NULL PRIMARY KEY,
"publisher_id" integer NOT NULL,
)
Sorry if these are stupid questions but I would like to understand it
completely.
Regards,
Gergely
-- Forwarded message --
From: Russell Keith-Magee
Date: 2010
On Mon, Aug 9, 2010 at 7:28 AM, Ersin Er wrote:
> Hi,
>
> I was just trying the sample code from the Django Book 2nd Edition but
> the generated SQL script for the Books models are not correct.
>
> The Model code:
>
> http://dpaste.com/226416/
>
> The generated SQL script for sqlite:
>
> http://dp
Hi,
I was just trying the sample code from the Django Book 2nd Edition but
the generated SQL script for the Books models are not correct.
The Model code:
http://dpaste.com/226416/
The generated SQL script for sqlite:
http://dpaste.com/226417/
What's missing in the generated script is
'REFEREN
12 matches
Mail list logo