修复了影响生产环境的问题,在生产环境中成功运行

This commit is contained in:
2026-06-15 00:01:46 +08:00
parent a155dc9f33
commit 8b9dbcba6f
18 changed files with 207 additions and 53 deletions

View File

@@ -1,7 +1,5 @@
from django.db import models
# Create your models here.
class YonghuPingzheng(models.Model):
id = models.AutoField(primary_key=True, verbose_name='自增主键ID')
@@ -26,7 +24,7 @@ class YonghuPingzheng(models.Model):
class Dianpu(models.Model):
id = models.AutoField(primary_key=True, verbose_name='店铺自增ID')
pingzheng = models.OneToOneField(
'shangdian.YonghuPingzheng', # 同应用内可简写,但完整路径更清晰
'shop.YonghuPingzheng', # 同应用内可简写,但完整路径更清晰
on_delete=models.CASCADE,
db_index=True,
verbose_name='关联用户凭证'
@@ -149,7 +147,7 @@ class DianpuShouzhiMeiriTongji(models.Model):
class YonghuDianpuBangding(models.Model):
id = models.AutoField(primary_key=True, verbose_name='绑定自增ID')
yonghu = models.ForeignKey(
'yonghu.UserMain', # 🔥 完整路径
'users.UserMain', # 🔥 完整路径
to_field='yonghuid',
on_delete=models.CASCADE,
db_index=True,
@@ -166,8 +164,6 @@ class YonghuDianpuBangding(models.Model):
unique_together = [['yonghu', 'dianpu']]
# shangdian/models.py
class ShangpinLeixingDianpu(models.Model):
"""
店铺级商品类型映射表
@@ -175,14 +171,14 @@ class ShangpinLeixingDianpu(models.Model):
"""
id = models.AutoField(primary_key=True, verbose_name='类型自增ID')
dianpu = models.ForeignKey(
'shangdian.Dianpu',
'shop.Dianpu',
on_delete=models.CASCADE,
db_index=True,
verbose_name='所属店铺'
)
# 🔥 强制映射到公共商品类型,不可为空
gonggong_leixing = models.ForeignKey(
'shangpin.ShangpinLeixing',
'shop.ShangpinLeixing',
on_delete=models.CASCADE,
db_index=True,
verbose_name='映射的公共商品类型'