43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
# Generated by Django 6.1.1 on 2026-09-18 11:45
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Category',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=100)),
|
|
('slug', models.SlugField(unique=True)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Category',
|
|
'verbose_name_plural': 'Categories',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Product',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=200)),
|
|
('image', models.ImageField(upload_to='products/')),
|
|
('rating', models.DecimalField(decimal_places=1, max_digits=2)),
|
|
('price', models.DecimalField(decimal_places=2, max_digits=10)),
|
|
('old_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
|
|
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='api.category')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Product',
|
|
'verbose_name_plural': 'Products',
|
|
},
|
|
),
|
|
]
|