feat: 只看审核按俱乐部隔离,商品管理支持俱乐部视图

未绑店出货开关按 club_id 配置;后台商品列表可在具体小程序下管理并切换审核展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-21 03:20:03 +08:00
parent ed627fa6f7
commit 6515568ec0
9 changed files with 249 additions and 42 deletions

View File

@@ -0,0 +1,44 @@
from django.db import migrations, models
def forwards_fill_club_id(apps, schema_editor):
Model = apps.get_model('shop', 'DianpuShangpinShenheShezhi')
# 历史全局单例 → 归到星阙 xq若已有多行则只保留一条
rows = list(Model.objects.all().order_by('id'))
if not rows:
return
keep = rows[0]
keep.club_id = keep.club_id or 'xq'
keep.save(update_fields=['club_id'])
for extra in rows[1:]:
extra.delete()
def noop_reverse(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('shop', '0003_zhi_kan_shenhe'),
]
operations = [
migrations.AddField(
model_name='dianpushangpinshenheshezhi',
name='club_id',
field=models.CharField(
db_index=True, default='xq', max_length=16, verbose_name='所属俱乐部',
),
),
migrations.RunPython(forwards_fill_club_id, noop_reverse),
migrations.AlterField(
model_name='dianpushangpinshenheshezhi',
name='club_id',
field=models.CharField(
db_index=True, default='xq', max_length=16, unique=True,
verbose_name='所属俱乐部',
),
),
]