简体   繁体   English

Django还原和代理模型

[英]Django-reversion and proxy models

I'm having trouble saving my model revisions when there are proxy models defined. 当定义了代理模型时,无法保存模型修订。

class MyModel(models.Model):
    field = model.IntegerField(...)


class MyModelProxy(MyModel):
    class Meta:
        proxy = True


reversion.register(MyModel)

I'm using this proxy model on my views and forms. 我正在视图和表单上使用此代理模型。 When I try to save it, it doesn't appear in the table reversion_version. 当我尝试保存它时,它没有出现在表reversion_version中。 Of course entry for MyModelProxy class is added to appropriate tables. 当然,MyModelProxy类的条目将添加到适当的表中。 I'm using django-reversion 1.7 我正在使用django-reversion 1.7

I'm the author of django-reversion! 我是django-reversion的作者!

This is a known issue with proxy models, due to a bug in Django's content types framework that was only fixed very recently. 这是代理模型的一个已知问题,这是由于Django的内容类型框架中的错误仅在最近才修复。

A discussion on the issue can be found here: 有关此问题的讨论可以在这里找到:

https://github.com/etianen/django-reversion/issues/134 https://github.com/etianen/django-reversion/issues/134

Of course, now that the underlying issue with Django has been fixed, pull requests to add proxy model support would be greatly appreciated! 当然,既然Django的基本问题已得到解决,那么添加代理模型支持的拉取请求将不胜感激!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM