I have a model, Document, and an associated DocumentForm(forms. ModelForm), and a DocumentAdmin(admin.ModelAdmin). In the clean method of the DocumentForm, I need to get the document_id (ie primary key) of the underlying Document, but it is not included in the field set for that form. I need the primary key, because one of the fields on the form belongs to another model (it is a JSON field), and I need to save that field in the other model when the DocumentForm is saved.
-- How do I access the primary key of the underlying Model in a ModelForm?
Thanks!
Mark
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEqej2OAvc78CgykeYYs5Wvc-MPQRR0Lnhp5NYQt3hpVf_cv8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment