Plugins Developement | Create instance with ManyToMany fields #13399
Unanswered
AVariot
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
Actually my plugins is using model.ManyToMany fields. When i want to create a new objects i have
'ManyRelatedManager' object has no attribute 'pk'
. I think i need to rewrite the save methode but it doesn't work.If i do that : " def save(self, commit=True, *args, **kwargs):
facture = super(FactureForm, self).save(commit=False, *args, **kwargs)
facture.date_facture = self.cleaned_data.get('date_facture')
facture.numero_facture = self.cleaned_data.get('numero_facture')
facture.commande = self.cleaned_data.get('commande')
return facture" i got this : "Operation failed due to object-level permissions violation"
Someone could help me, and tell me how can i rewrite the save methode (if it's that what i need)
Thank you
Beta Was this translation helpful? Give feedback.
All reactions