Hello Abraham,
thanks for your answer!
On Mon, 12. Dec 10:15, 'Abraham Varricatt' via Django users <
django...@googlegroups.com> wrote:
> What about using the forms validate() method? i.e. if the user has not
> filled in all the JSON details, return a validation error. This should give
> them the opportunity to make edits or re-type as needed.
Yes, I probably should validate the input that way, but what I'm
concerned with at the moment is how the JSON details make it to the
form object in the first place.
I probably got overwhelmed reading the API Docs and thought there has
to be a more elegant way to handle the JSON -> Form Object part than
just writing a ``post`` method.
> > On another note, there are several Models I want to work with in
> > this way so it would be even better if I could select the model
> > class according to the contents of the json file.
> >
>
> This sounds like a validation job to me. Just put in all the logic checks
> into the validate() method. Bear in mind that you are likely to receive bad
> input, so handle accordingly.
As in validating the ModelForms for each object and choose the one
that validates successfully if any?
Jochen