Monday, October 3, 2011

Re: loaddata and auto_now_add=True

i think bcoz load data does not use the orm api..while your test use orm to insert data..

On Oct 3, 2011 3:43 PM, "Reikje" <reik.schatz@gmail.com> wrote:
> Hi, I have a test fixture file which I use in unit tests. In some
> Models I have date fields defined like this:
> models.DateTimeField(auto_now_add=True) for which I don't specify
> values in the fixture file (users.json). This works well as part of
> testing but when I want to load the fixture into the real database
> using the loaddata command, it will complain about these fields being
> null, i.e. Warning: Column 'last_seen_at' cannot be null
>
> Whats the difference between running the fixture file as part of the
> test suite and loading it using loaddata. I guess I can work around
> this by adding values for these fields but I am lazy :)
>
> --
> 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 django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment