Django:代理元类忽略 verbose_name_plural
Django-admin 正在多元化我作为代理类运行的模型。
这里的正常情况工作正常:
class Triviatheme(models.Model):
[ ... elided ... ]
class Meta:
db_table = u'TriviaTheme'
verbose_name_plural='trivia themes'
但是对于主内容表,我有一个名为“Content”的父模型和一个代理类:
class News(Content):
DTYPE='News'
class Meta:
verbose_name_plural='News'
proxy = True
但是内容中的元仍然复数“News”导致“Newss”,所以它忽略verbose_name_plural 字段,但不是 proxy 字段。
同样,重写父类中的字段似乎也没有效果。我缺少什么?有没有更好的方法来实现带有鉴别器列的大表模型?
请注意,这是从不同的应用程序对数据库进行逆向工程,因此模型设置得很好,我不能只更改架构。
编辑:
我使用的是 python 2.6 / Django 1.2.1
我还使用 Manager 类来处理鉴别器,但它仍然不起作用。
Django-admin is pluralizing a model that I have running as a proxy class.
The normal case here works fine:
class Triviatheme(models.Model):
[ ... elided ... ]
class Meta:
db_table = u'TriviaTheme'
verbose_name_plural='trivia themes'
But for a main content table, I have a parent model called 'Content', and a proxy class:
class News(Content):
DTYPE='News'
class Meta:
verbose_name_plural='News'
proxy = True
But with the Meta in Content is still pluralizing 'News' resulting in 'Newss', so its ignoring the verbose_name_plural field, but not the proxy field.
Similarly, overriding the field in the parent class seems to have no effect. What am I missing? Is there a better way of implementing a large table model with a discriminator column?
Note that this is reverse engineering a DB from a different app, so the model is pretty well set and I can't just change the schema.
edit:
I'm on python 2.6 / Django 1.2.1
I'm also using a Manager class to handle the discriminator, but its still not working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FWIW 我用 Django 1.1.1 和 Django 1.2.1 对此进行了测试,在这两种情况下它都按预期工作。
FWIW I tested this with Django 1.1.1 and Django 1.2.1 and it worked as expected in both cases.