django_magazine/shop/migrations/0001_initial.py

91 lines
4.3 KiB
Python

# Generated by Django 4.1.5 on 2023-01-22 16:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
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, unique=True)),
('slug', models.SlugField(max_length=100, unique=True)),
('description', models.TextField(blank=True, max_length=250)),
('image', models.ImageField(blank=True, upload_to='categories')),
],
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=100, unique=True)),
('slug', models.SlugField(max_length=100, unique=True)),
('description', models.TextField(blank=True, max_length=300)),
('price', models.DecimalField(decimal_places=2, max_digits=6)),
('discount', models.DecimalField(decimal_places=2, default=0.0, max_digits=6)),
('image', models.ImageField(upload_to='photos/products')),
('stock', models.IntegerField()),
('new', models.BooleanField(default=False)),
('is_available', models.BooleanField(default=True)),
('date_joined_for_format', models.DateTimeField(auto_now_add=True)),
('last_login_for_format', models.DateTimeField(auto_now=True)),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.category')),
],
options={
'verbose_name_plural': 'Products',
'ordering': ('-date_joined_for_format',),
},
),
migrations.CreateModel(
name='Variation',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('variation_category', models.CharField(choices=[('color', 'color'), ('size', 'size')], max_length=100)),
('variation_value', models.CharField(max_length=100)),
('is_active', models.BooleanField(default=True)),
('created', models.DateTimeField(auto_now_add=True)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.product')),
],
),
migrations.CreateModel(
name='ReviewRating',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('review', models.TextField(blank=True, max_length=700)),
('rating', models.FloatField()),
('ip', models.CharField(blank=True, max_length=20)),
('status', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.product')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='ProductGallery',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to='product_gallery')),
('product', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='shop.product')),
],
options={
'verbose_name': 'productgallery',
'verbose_name_plural': 'product gallery',
},
),
]