Milan Andric wrote: > I have a long application form for a workshop (name, employment, > resume, ... 65 fields). The user logs in to the site via > django.contrib.auth.view.login, standard django fare. Then the user is > allowed to apply for workshop xyz. If the user clicks save but does > not complete the form, errors are shown and the user gets a message > explaining the incomplete state of the form, but the form data is also > saved in the database, just flagged with complete = 0. Only when the > form validates does Application.complete field get set to 1 so > reviewers know to look at it.
I think you don't even have to hack a manipulator... You just define all needed validators and then in a view you can do this: # get data and errors data = request.POST.copy() errors = manipulator.get_validation_errors(data) manipulator.do_html2python(data) # save data regardless of errors object = manipulator.save(data) # show results to a user if errors: object.complete = False object.save() else: return HttpResponseRedirect(...) > What other problems might I run into by disregarding > manipulator.get_validation_errors and saving anyway? This approach doesn't distinct between absent data (which is ok) and broken data (which is not). I could think of such a hack: you get standard validation errors then set all fields in the manipulator as not required and get validation errors one more time. This way you will get only critical errors: errors = manipulator.get_validation_errors(data) for field in manipulator.fields: field.is_required = False critical_errors = manipulator.get_validation_errors(data) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---