Bolek Lolek
Bolek Lolek

Reputation: 1

syncdb - no such table error

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

Answers (2)

Burhan Khalid
Burhan Khalid

Reputation: 174748

Did you forget to add 'main' to your apps in settings.py?

Upvotes: 2

Brandon Taylor
Brandon Taylor

Reputation: 34593

You need to use a ModelChoiceField for the region in the form.

Upvotes: 0

Related Questions