add() for ManyToManyField which specifies an intermediary model

前端 未结 1 899
被撕碎了的回忆
被撕碎了的回忆 2021-01-12 09:56

There are many questions about this Exception:

AttributeError: Cannot set values on a ManyToManyField which specifies 
an intermediary model.
Use myapp.MyThr         


        
相关标签:
1条回答
  • 2021-01-12 10:01

    I found a way to tell django to ignore the extra data:

    class MyThroughModel(Model):
        class Meta():
            auto_created=True
        ...
    

    Update

    This creates issues with the django internal migrations. We updated our code and don't use auto_created = True any more.

    0 讨论(0)
提交回复
热议问题