On 8/24/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
>
> Al-rightly then... thoughts?
>

+1 ValidationErrors with an s, as I've said before: the more errors
returned at once, the better.

My problem with Joseph's proposal is that I believe it to be too tied
to the concept of the Model.  Idealy, the Form/Manipulator should not
really have anything to do with a Model, except perhaps in the
finalization, like in .save().

Also it doesn't end up actually leveraging model-validation.  You'd
have to define the validation twice, once in the Model, and then once
in Field.  But leveraging on the Model validation turns out to be
rather tricky anyway, even in my proposal.  Lo:

Let's say I have a dict, named "poll_data" with a data for a new Poll
object.  And an dict, named "choice_data", which has info for a new
choice added in the inline.

poll = Poll(**poll_data)
errors = poll.save()  # We don't get any errors.

poll.choice_set.create(**choice_data)
errors = choice.save() # But we get some here.

So now we return the form with the errors.  But the user decides that
he can't add his clever poll with a choice that is empty, so he
cancels and goes home for the day, expecting that his poll was never
created.  But alas, it IS created because we did "poll.save()".  We
could rework it to do poll.validate() instead of saving, but since the
Poll then hasn't been created yet, you have to make the Choice without
a poll, and then assign it after.  Seems like a transaction.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to