Hello Abraham,
thanks for your answer!
On Mon, 12. Dec 10:15, 'Abraham Varricatt' via Django users <django-users@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
--
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/20161213081852.GA12521%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment