Reputation: 1
When I try syncdb on my project , I've got error:
return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: main_region
forms.py
from main.models import Region
class ChangeState(forms.Form):
region = forms.ChoiceField(choices=Region.objects.all(),required=False)
state = forms.CharField(max_length=20)
models.py
class Region(models.Model):
name = models.CharField(max_length=50)
When I was comment line:
region = forms.ChoiceField(choices=Region.objects.all(),required=False)
syncdb works OK.
What's going on ?
Thanks in advance for explain.
Upvotes: 0
Views: 956
Reputation: 34593
You need to use a ModelChoiceField for the region in the form.
Upvotes: 0