Validate stored data against a form in django
Obviously when you save data through a form you can run validation through
it's clean method, but then if you wanted to re-validate that data every
time you view it can you just run the form's clean method again?
I was thinking the view would go along the lines of;
def detail(request, person_id=None):
"""
Renders an individual person
@param employer_id: The id of employer to view
@param request: HttpRequest
@return: HttpResponse
"""
person = get_object_or_404(People, pk=person_id)
validation_form = AddForm(instance=person)
is_valid = validate_person(validation_form)
return render_to_response(
'person/detail.html',
{
'is_valid': is_valid,
},
context_instance=RequestContext(request))
But what would be the 'proper' way of doing validate_person()?
No comments:
Post a Comment