#22864 closed Bug (invalid)
syncdb/test not possible when using dynamic choices from django.contrib.auth.models.user
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello
I found an strange bug while testing around with python manage.py test.
As soon as django tries to create the database it stops with the following error:
django.db.utils.OperationalError: no such table: auth_user
Error Stack:
http://pastebin.com/pXPHkwJT
The error is caused by:
class Character(models.Model): def _choices_user(): users = User.objects.all() users = users.order_by('id') return [(e.id, e.username) for e in users] ...
I uploaded an sample project here https://github.com/ManuelGysin/ChoicesBugDjango.
Change History (2)
comment:1 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Hello!
In a normal case yes. But in my scenario we use a multi database setup.
The only way to is to use IntegerField!
Correct me if I'm wrong but I think this is a bug.
Note:
See TracTickets
for help on using tickets.
It's not a bug in Django. Consider using a
ForeignKey
rather thanIntegerField
. If you need further help, please use our support channels.https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels