Reputation: 90
I totally beginner in django. I create one model which is in models folder and run python manage.py makemigrations still its show No changes detected
product.py
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=50)
price = models.IntegerField(default=0)
description = models.CharField(max_length=200, default='')
image = models.ImageField(upload_to="products/")
init.py (models/init.py)
from .product import Product
Thanks in advance
Upvotes: 0
Views: 807
Reputation: 42
First you have to create the database with python manage.py migrate
.
If you have already created your models before doing this step there is no need to do makemigrations
.
You have to use makemigrations only to collect the new changes and next apply this changes with python manage.py migrate
.
python manage.py migrate
.python manage.py makemigrations
.python manage.py migrate
again.Upvotes: 0