Allow to specify the field name that should be used to relate to parent models, along with the name that should be passed to context containing the parent object.
Also, implement some magic to locate the correct FK field when no field is declared, using _meta API.
To avoid overriding get and post methods, pre_get and pre_post are provided instead, with both methods being called just before the execution is transferred to the framework implementation of CBVs. In that stage, both the new and the parent objects are available.
Allow to specify the field name that should be used to relate to parent models, along with the name that should be passed to context containing the parent object. Also, implement some magic to locate the correct FK field when no field is declared, using _meta API. To avoid overriding
get
andpost
methods,pre_get
andpre_post
are provided instead, with both methods being called just before the execution is transferred to the framework implementation of CBVs. In that stage, both the new and the parent objects are available.