Re: loading fixtures: no error, no data

2007-08-01 Thread omat

I am using postgresql with postgresql_psycopg2.



On 1 Ağustos, 17:21, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
>
>
> > Shouldn't Django be reporting that failure? Success messages are
> > confusing.
>
> I _did_ get an error message, warning me about an invalid primary key:
>
> psycopg.DatabaseError: {: 'ERROR:  insert
> or update on table "mytest_documentissue" violates foreign key
> constraint "mytest_documentissue_user_id_fkey"\nDETAIL:  Key
> (user_id)=(2) is not present in table "auth_user".\n'}
>
> Admittedly, the error was a little cryptic, but it did name the model
> and pk value that was missing.
>
> I can only presume this is a database-specific difference. I'm using
> Postgres - what database backend are you using?
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee

On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> Shouldn't Django be reporting that failure? Success messages are
> confusing.

I _did_ get an error message, warning me about an invalid primary key:

psycopg.DatabaseError: {: 'ERROR:  insert
or update on table "mytest_documentissue" violates foreign key
constraint "mytest_documentissue_user_id_fkey"\nDETAIL:  Key
(user_id)=(2) is not present in table "auth_user".\n'}

Admittedly, the error was a little cryptic, but it did name the model
and pk value that was missing.

I can only presume this is a database-specific difference. I'm using
Postgres - what database backend are you using?

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread omat

Yes, the problem was I didn't have the second user on the db that I an
trying to initialize. As I only dump data for one application, and the
user data is in an other application, the foreign key constraint
fails. Thanks a lot...

Shouldn't Django be reporting that failure? Success messages are
confusing.



On 1 Ağustos, 16:57, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
>
>
> > My bad. In my previous post, I think it would be a good idea to crop
> > the models a bit for simplicity. Please use this one:
> >http://dpaste.com/hold/15751/
>
> Works fine for me, as long as you have two users defined (pk=1 and
> pk=2). The fixture you provided didn't define them, but I presume you
> have created them elsewhere.
>
> Whatever the problem is, it's very much local to your machine. I can
> only suggest starting a clean project from scratch (paying particular
> attention to paths, settings, etc), and see if you can replicate the
> issue.
>
> Yours,
> Russ Magee  %-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee

On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> My bad. In my previous post, I think it would be a good idea to crop
> the models a bit for simplicity. Please use this one:
> http://dpaste.com/hold/15751/

Works fine for me, as long as you have two users defined (pk=1 and
pk=2). The fixture you provided didn't define them, but I presume you
have created them elsewhere.

Whatever the problem is, it's very much local to your machine. I can
only suggest starting a clean project from scratch (paying particular
attention to paths, settings, etc), and see if you can replicate the
issue.

Yours,
Russ Magee  %-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread omat

My bad. In my previous post, I think it would be a good idea to crop
the models a bit for simplicity. Please use this one:
http://dpaste.com/hold/15751/



On 1 Ağustos, 16:31, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the reply Russ...
>
> > The models are here:
> >http://dpaste.com/hold/15746/
>
> > The dump in json format is here:
> >http://dpaste.com/hold/15747/
>
> Are you sure the fixture comes from these models? I get an immediate
> failure because industry doesn't have a field named slug - the fixture
> references this field, but the model doesn't.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee

On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> Thanks for the reply Russ...
>
> The models are here:
> http://dpaste.com/hold/15746/
>
> The dump in json format is here:
> http://dpaste.com/hold/15747/
>
Are you sure the fixture comes from these models? I get an immediate
failure because industry doesn't have a field named slug - the fixture
references this field, but the model doesn't.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread omat

I have custom save methods like:

class Issue(models.Model):
title = models.CharField(maxlength=150)
parent = models.ForeignKey('self',
   null = True,
   blank = True)
industries = models.ManyToManyField(Industry,
null = True,
blank = True)
slug = models.SlugField(maxlength = 100,
editable = False)

def save(self):
slug = self.title
parent = self.parent
while parent:
slug = '%s %s' % (parent, slug)
parent = parent.parent
self.slug = slugify(slug)
super(Issue, self).save()
for child in Issue.objects.filter(parent = self):
child.save()

Using the admin, I was able to add objects, so I think the custom
save() works fine. Can loaddata be misinterpreting the custom save()?

For the paths suggestion, I drop the tables and run syncdb. The tables
are created, but they are not populated. Syncdb sees correctly which
db I meant while creating tables.


In my previous post, I have omitted custom save() methods in the
models for simplicity but I see it can be critical, so here is the
full model:
http://dpaste.com/hold/15751/



On 1 Ağustos, 16:14, omat <[EMAIL PROTECTED]> wrote:
> Thanks for the reply Russ...
>
> The models are here:http://dpaste.com/hold/15746/
>
> The dump in json format is here:http://dpaste.com/hold/15747/
>
> On 1 Ağustos, 15:52, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> > > Installed 34 object(s) from 1 fixture(s)
>
> > If this message is getting printed, then the fixture is getting loaded
> > _somewhere_, save() has been called on 34 object instances, and the
> > transaction has been successfully committed.
>
> > The only way I can think that the data would go missing was if it was
> > loaded into a different database. However, I can't think of any
> > obvious way that you could do this.
>
> > Another possibility is that the loaddata success is getting
> > misreported somehow. If you forward your model and fixture I'll try it
> > at my end and see if I can replicate the problem.
>
> > Yours,
> > Russ Magee %-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee

On 8/1/07, David Reynolds <[EMAIL PROTECTED]> wrote:
>
> How about .save() is being overridden and Super(Model, self).save()
> isn't being called?

FYI - as of [5658], fixtures call save() directly on the base Model
class, ignoring any user-defined save method.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread omat

Thanks for the reply Russ...

The models are here:
http://dpaste.com/hold/15746/

The dump in json format is here:
http://dpaste.com/hold/15747/




On 1 Ağustos, 15:52, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
>
>
> > Installed 34 object(s) from 1 fixture(s)
>
> If this message is getting printed, then the fixture is getting loaded
> _somewhere_, save() has been called on 34 object instances, and the
> transaction has been successfully committed.
>
> The only way I can think that the data would go missing was if it was
> loaded into a different database. However, I can't think of any
> obvious way that you could do this.
>
> Another possibility is that the loaddata success is getting
> misreported somehow. If you forward your model and fixture I'll try it
> at my end and see if I can replicate the problem.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: loading fixtures: no error, no data

2007-08-01 Thread David Reynolds


On 1 Aug 2007, at 1:52 pm, Russell Keith-Magee wrote:



On 8/1/07, omat <[EMAIL PROTECTED]> wrote:


Installed 34 object(s) from 1 fixture(s)


If this message is getting printed, then the fixture is getting loaded
_somewhere_, save() has been called on 34 object instances, and the
transaction has been successfully committed.

The only way I can think that the data would go missing was if it was
loaded into a different database. However, I can't think of any
obvious way that you could do this.

Another possibility is that the loaddata success is getting
misreported somehow. If you forward your model and fixture I'll try it
at my end and see if I can replicate the problem.


How about .save() is being overridden and Super(Model, self).save()  
isn't being called?


Check you don't have 2 folders/projects of the same name on your  
python path and it's using the database referred to in the other  
one's settings file?


Thanks,

Dave

--
David Reynolds
[EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee

On 8/1/07, omat <[EMAIL PROTECTED]> wrote:
>
> Installed 34 object(s) from 1 fixture(s)

If this message is getting printed, then the fixture is getting loaded
_somewhere_, save() has been called on 34 object instances, and the
transaction has been successfully committed.

The only way I can think that the data would go missing was if it was
loaded into a different database. However, I can't think of any
obvious way that you could do this.

Another possibility is that the loaddata success is getting
misreported somehow. If you forward your model and fixture I'll try it
at my end and see if I can replicate the problem.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---