python - django migration creates table with only one field -
i'm trying create django app named 'store' , when execute ./manage.py makemigration store
./manage.py migrate store
migration applying correctly when viewing table in phpmyadmin has 1 field.
my model code follows:
from django.db import models class module(models.model): class meta: verbose_name = "module" verbose_name_plural = "modules" def __unicode__(self): return self.name def __str__(self): return self.name name = models.charfield(max_length=100, required=true) version = models.charfield(max_length=10,default='0.1') description = models.charfield(max_length=500,default="no description")
and result of ./manage.py sqlmigrate store
:
begin; create table `store_module` (`id` integer auto_increment not null primary key); commit;
i use django 1.7 on python 2.7 , mysql database.
name = models.charfield(max_length=100, required=true)
as can see field model field , not form field.so, required=true won't work in case.instead use blank=false specified in docs below.
hopefully can potential issue.please let me know other explanations in comments.
Comments
Post a Comment