http://dpaste.com/hold/645547/
-- On Tue, Nov 1, 2011 at 11:39 AM, luke lukes <lordluke80@gmail.com> wrote:
i have this template: http://dpaste.com/645468/ that send data to this
view: http://dpaste.com/645469/. the template display a form made by
modelforms, with a custom layout. i have to validate the fields value
send to view, and then redirect to the same template if the field
validation fails. i've tried to do it by creating an instance of the
related model, then gathering all fields one by one (checking before
if they are present in request.POST) and assigning it to the model
field, and then assigning that model instance to a new modelform
instance. then i've prefromed a .is_valid() check, but it fails since
it require the model instance pc, so that model instance need to exist
on db. so how can i validate those data, and if validation fails,
redirect to another template and display the errors?
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment