fix: 公告按页、身份标签权限与菜单种子

This commit is contained in:
XingQue
2026-06-25 15:50:54 +08:00
parent 9575edcfc4
commit 59f5a695d8
4 changed files with 78 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
from django.db import migrations
def copy_gonggao_to_other_pages(apps, schema_editor):
"""将 order_pool 公告复制到 accept_order / merchant_home仅当目标页尚无记录"""
Gonggao = apps.get_model('config', 'Gonggao')
for pk in ('accept_order', 'merchant_home'):
for row in Gonggao.objects.filter(page_key='order_pool'):
if Gonggao.objects.filter(club_id=row.club_id, page_key=pk).exists():
continue
Gonggao.objects.create(
club_id=row.club_id,
page_key=pk,
NoticeType=row.NoticeType,
Content=row.Content or '',
)
class Migration(migrations.Migration):
dependencies = [
('config', '0008_gonggao_page_key'),
]
operations = [
migrations.RunPython(copy_gonggao_to_other_pages, migrations.RunPython.noop),
]