Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

公共字段表如何调整更新人字段为ForeignKey #32

Open
a851379672 opened this issue Dec 9, 2024 · 0 comments
Open

公共字段表如何调整更新人字段为ForeignKey #32

a851379672 opened this issue Dec 9, 2024 · 0 comments

Comments

@a851379672
Copy link

github无法上传图,可能是内网原因,请看以下具体内容
BaseTable.updater调整:
updater = models.ForeignKey(
to=settings.AUTH_USER_MODEL,
related_query_name="updater_query",
null=True,
verbose_name="更新人",
help_text="更新人",
on_delete=models.SET_NULL,
db_constraint=False
)
django启动报错:
SystemCheckError: System check identified some issues:

ERRORS:
lunarlink.API.creator: (fields.E304) Reverse accessor for 'lunarlink.API.creator' clashes with reverse accessor for 'lunarlink.API.updater'.
HINT: Add or change a related_name argument to the definition for 'lunarlink.API.creator' or 'lunarlink.API.updater'.
lunarlink.API.updater: (fields.E304) Reverse accessor for 'lunarlink.API.updater' clashes with reverse accessor for 'lunarlink.API.creator'.
HINT: Add or change a related_name argument to the definition for 'lunarlink.API.updater' or 'lunarlink.API.creator'.
(其他模型也是报这个错)

然后我尝试了其他方法,但也会有其他的报错,如:
related_query_name="updater_query" 调整为 related_name="%(class)s_updated"
此时可以启动成功,但是其他地方会有报错,如访问项目列表接口报错
Field 'id' expected a number but got <MyUser: wfq100960>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant