Tuesday, August 4, 2020

how to create table from model

Hi All,

I am new to Django. I want to create tables by using models.

models.py
from django.db import models


# Create your models here.
class Person(models.Model):
id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
I have registered the app and provided connection details of the DB.

But when I tried to run makemigrations and migrate, it's not identifying the changes.
python manage.py makemigrations
No changes detected

python manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  No migrations to apply.

any help would be appriciated.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e8f15897-5729-4b51-9ab3-bec0c159dcfco%40googlegroups.com.

No comments:

Post a Comment