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:
Parsa Nazer
2025-08-02 18:57:46 +03:30
parent d955fcb107
commit d0dfa3eaa7
7 changed files with 115 additions and 4 deletions
@@ -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': 'فروشگاه ها',
},
),
]