Add ShopModel and integrate with ProductModel
- Created ShopModel with fields for shop name, description, and user association. - Updated ProductModel to include a foreign key relationship with ShopModel. - Added admin interface for ShopModel with search functionality. - Created migrations for ShopModel and its integration with ProductModel.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.1.2 on 2025-08-02 15:21
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('account', '0028_newsmodel_is_read'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ShopModel',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('shop_name', models.CharField(max_length=100, verbose_name='نام فروشگاه')),
|
||||
('shop_description', models.TextField(verbose_name='توضیحات فروشگاه')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='shop', to=settings.AUTH_USER_MODEL, verbose_name='کاربر')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'فروشگاه',
|
||||
'verbose_name_plural': 'فروشگاه ها',
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user