Creating field classes for validation makes sense but what if I need to
validate in a request context?

Say for example that I need to check permissions for request.user in
clean?

def clean(self, value):
  if request.user.has_some_property() and value > 100:
    raise forms.ValidationError, 'You are not allowed to go that high,
please enter a value below 100.'
 return value

Another example would be if one field needs to be compared to another
field.

Checking in form.clean() disconnects the error from the field so thats
not good.

I just noticed that you can define clean_<field_name>() which may be
what I need. Btw, why is not the current cleaned value passed to that
method?

Joakim


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to