有没有一种方法可以将字段添加到Django的Sites Framework中? [英] Is there a way to add fields onto Django's Sites Framework?

查看:47
本文介绍了有没有一种方法可以将字段添加到Django的Sites Framework中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢使用站点框架的构想,该构架可以使应用程序在多个网站上正常运行.有没有一种方法可以将字段添加到数据库的 Site 对象上,还是应该只创建外键一对一关系?

I really like the idea of the sites framework for making an application functional across multiple web sites. Is there a way to add fields onto the Site object for the database, or should I just create a foreign-key one-to-one relationship?

推荐答案

是的,请使用具有唯一外键的模型.Django会将其作为反向关系添加到Site.

Yes, use a model with a unique foreign key. Django will add it to Site as a reverse relationship.

这篇关于有没有一种方法可以将字段添加到Django的Sites Framework中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆