How To Create Django Models

Pinterest LinkedIn Tumblr

Create a model field within file

class Contact(models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField(max_length=100)
    subject = models.CharField(max_length=100)
    message = models.TextField()
    mobile = models.IntegerField(max_length=180)
    created_on = models.DateTimeField(auto_now_add=True)

Associate with


Run migrations command

python makemigrations

Check Migration

python showmigrations
python migrate

Write A Comment

Faster PHP Cloud Hosting