I'm new to python and django, I'm creating a simple shopping app. I have followed all the steps to create django rest-framework project, run the server and it works.
What I did is created a new folder called Models (deleted the pre-defined models.py
) and created inside it many model classes in addition of an __init__.py
file as I red and imported all the classes inside it.
When running python manage.py makemigrations
it return ''No changes detected''.
Here is the structure:
quickstart/
.
.
`Models/
__init__.py
model1.py
model2.py
.
.
.
tutorial/
manage.py
Here is a created class:
from django.db import models
from quickstart.Models.Product import Product
class Image (models.Model):
id = models.IntegerField(primary_key=True, auto_created=True)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
image_url = models.TextField()