4👍
✅
db_table
option gives a flexibility to user for specifying a database table name.
From the error it looks like that table gender
does not exist in database. That means after specifying this option you haven’t performed syncdb
. Please do a syncdb
or if you are using south then schemamigration
.
3👍
I got the solution, if you want to change you model name using like this..
class Gender(models.Model):
name = models.CharField(max_length=20)
class Meta:
db_table = 'gender'
after that you have to maigrate your model again
python manage.py makemigrations
python manage.py migrate
- [Django]-Django: is importing a view from a module slower than including it in the main views.py file?
- [Django]-Internationalizing images in django
Source:stackexchange.com