Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

How we add new column in django :-

to add new column or filed in django after creating table we should manage following steps

1)  go into model.py and add field if filed is CharacterField then write

models.CharField(max_length=100, default='')

if field is DateTime then write following 
code 
models.DateTimeField(auto_now=True)

2)  python manage.py makemigrations appname

3) python manage.py sqlmigrate appname newmigrationfilename     (example if 0004 then you write python manage.py sqlmigrate appname 0004)


4)  python manage.py migrate



Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post