Python Django tworzy produkty

// go to terminal 
python manage.py startapp products
// go to settings.py 
INSTALLED_APPS = [
    'products.apps.ProductsConfig',
]
// go to products folder app - models.py 
from django.db import models
from category.models import Category

//Create your models here.
class Product(models.Model):
    product_name    = models.CharField(max_length=200, unique=True)
    slug            = models.SlugField(max_length=200, unique=True)
    description     = models.TextField(max_length=500, blank=True)
    price           = models.IntegerField()
    images          = models.ImageField(upload_to='photo/products')
    stock           = models.IntegerField()
    is_available    = models.BooleanField(default=True)
    category        = models.ForeignKey(Category, on_delete=models.CASCADE)
    created_date    = models.DateTimeField(auto_now_add=True)
    modified_date   = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.product_name

// go to products folder app - admin.py 
from django.contrib import admin
from .models import Product

// Register your models here.
class ProductAdmin(admin.ModelAdmin):
    list_display = ('product_name', 'price', 'stock', 'category', 'modified_date', 'is_available')
    prepopulated_fields = {'slug': ('product_name',)}

admin.site.register(Product, ProductAdmin)
// go to editor terminal trying check errors 
python manage.py runserver 
// making migrations 
python manage.py makemigrations
// migrating 
python manage.py migrate
// check to your /admin/ if refelected 
BenLeolam