On Feb 13, 11:09 am, xina towner <xinatow...@gmail.com> wrote:
> Hello, I still get this error:
<SNIP>
> The problem es the order that django creates the tables in the database.
> Can I change this?

Are you sure the problem is not that importing the tests will generate
a query? The offending place seems to be:

>     from quests.forms import *
>   File "/home/xino/workspace/unnamedapp/quests/forms.py", line 487, in
> <module>
>     class SearchQuestForm(forms.Form):
>   File "/home/xino/workspace/unnamedapp/quests/forms.py", line 494, in
> SearchQuestForm
>     [CATEGORY_CHOICES.append((c.id, c.name)) for c in
> Category.objects.all()]

I am pretty sure that what is happening is that the tests are imported
before the database is created. And because of that, the table doesn't
exist at that point. It is only created after the import of the tests.

If the above hypothesis is correct, the solution would be to make the
Category.objects.all() query above lazy, so that it is executed only
when first needed, not at import time.

 - Anssi

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

Reply via email to