Django proxy model and ForeignKey

前端 未结 6 2083
温柔的废话
温柔的废话 2020-12-05 01:28

How to make entry.category to be instance of CategoryProxy? See code for details:

class Category(models.Model): pass

class Entry(models.Model):
    category         


        
6条回答
  •  無奈伤痛
    2020-12-05 01:35

    This is an open Django issue: #10961 (Allow users to override forward and reverse relationships on proxy models with ForeignKey fields)

    You can work around it by resetting the fields in question after you define the proxy models:

    EntryProxy.add_to_class('category', CategoryProxy)
    

提交回复
热议问题