How To Create Django Models

twitter logo github logo ・1 min read

Create a model field within models.py 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 settings.py

INSTALLED_APPS = [
'contact.apps.ContactConfig',
]

Run migrations command

python manage.py makemigrations

Check Migration

python manage.py showmigrations
python manage.py migrate

https://www.youtube.com/watch?v=rugSoarfi58&t=6s

https://realprogrammer.in/how-to-create-django-models/

twitter logo DISCUSS
Classic DEV Post from May 21

Microsoft Azure for Spoiled People

There may come a time in your career when you have to move from platforms such as Firebase and Netlify for app deployment to a more enterprise-focused platform such as Microsoft Azure. Here's an empathetic post for all the Spoiled People.

siddharth shukla profile image
I train professional software engineers that companies love to hire. I cover a wide range of subjects like programming, what's latest in tech, new frameworks, open-source products etc.