Does anyone know of a clean way to do partial validation in djangos
newforms.  I am basically after a cleaner way to do something like the
code below.

form = form(request.POST, error_class=SpanErrorList)

# Hacky but as of this moment newforms doesn't support partial

# validation or getting the valid data from normal validation

try:

        data = form.data['version']

        version = form.base_fields['version'].clean(data)

        build.version = version

except ValidationError:

        pass

try:

        data = form.data['build_number']

        build_number = form.base_fields['build_number'].clean(data)

        build.build_number = build_number

except ValidationError:

        pass

try:

        data = form.data['changelist']

        changelist = form.base_fields['changelist'].clean(data)

        build.changelist = changelist

except ValidationError:

        pass

try:

        data = form.data['comment']

        comment = form.base_fields['comment'].clean(data)

        build.comment = comment

except ValidationError:

        pass

build.save()
--~--~---------~--~----~------------~-------~--~----~
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