Hi Marcin, Marcin Kaszynski wrote: > The update_object view does, this: > > new_data = request.POST.copy() > errors = manipulator.get_validation_errors(new_data) > manipulator.do_html2python(new_data) > if not errors: > object = manipulator.save(new_data) > > The way I see it, new_data should be updated (with the values of > fields I want to preserve) before validation, so if I was to use your > patch I would have to overwrite get_validation_errors and update > new_data in there, before calling the "real" get_validation_errors, > right? Does not look too pretty to me.
You're right, and it *is* ugly. If only the Manipulator would use its follow attribute to decide which fields need to be validated. Or the if the generic view and manipulators provided a way for a clean prepopulate. I still enjoy this style a lot, and I'll probably sooner or later will end up with my own set of generic views. I don't have enough cases together to make a serious proposal about this, yet. Also, I feel I don't have a deeper understanding of the structure and interactions between generic views, manipulators, and form fields--yet ;-) But it looks right to me to keep all this "http transaction handling" out of the view and put it somewhere separately, at least in most cases. > Still, with my change I can avoid writing views at all (other than > keeping my own version of update_object). At the same time the > functionality I need seems very generic. I'll try it and see what > happens :) Be sure to report when you've found something that works well! If Adrian/Jacob/Luke/etc. is listening: Would you accept patches that provide docstrings for classes and methods within the Django internals? It would help a lot in understanding what's happening in the Django machinery. Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---