有没有一种方法可以将字段添加到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.