Important Commands about Models
===================================================================================6: What Are Django Models ?
=================================================================================== in this model whe add database filed 1) open model.py file from project from django.db import models class news(modles.model): author= models.charField(max_length=30) title =models.charField(max_length=30) description = modles.TextField() #First we make magration for this model and after magration , we transfere this model to my database. please remember before apply migration, this modle entry most be in setting.py file open setting.py and check installed_apps= [ "NewsApp" 2)------->python manage.py makemigrations open migration file project you see news files 3) now we migration this model to mysql database =============>python manage.py migrate now you check mysql pannel you weill this model now we create another model class sportnews(models.model) author= models.charField(max_length=30) title =models.charField(max_length=30) description = modles.TextField() now you apply the above two commands
===================================================================================References
===================================================================================
Last modified: Sunday, 2 February 2020, 11:41 AM