On Fri, 2007-07-13 at 01:31 -0400, Todd O'Bryan wrote: > On Fri, 2007-07-13 at 14:43 +1000, Malcolm Tredinnick wrote: > > > I'm -1 one on this for pretty much the same reasons as Adrian. It's just > > not that big a deal even for people who want to work the way you do. > > I should have re-subjected my second post, since I'm willing to accept > the loss of a possible field named form in the model as sufficient > reason for keeping form_for_instance and form_for_model outside the > model space. > > My question for the rest of the second message was a question of how > much separation between forms and models there should be. For me the > validation issue is key. We currently don't have any standard way to > programmatically validate model fields, but we can validate forms before > we stick them into model fields. Seems like it'd be easy to avoid some > duplication if we just admit the possibility that model fields can > optionally specify something about their form fields.
Okay, I understand where you're coming from. I think your concerns are mitigated somewhat by realising you are talking about something we are going to fix prior to 1.0: adding model-aware validation. The rough way this works is that you populate your model's fields, then call the validate() method (however it ends up being spelt) and it will raised ValidationError and provide access to an error dictionary, etc. All similar to forms, but related to the model. Thus, if your validation requirements are mostly related to the data semantics of a particular model, it will rightly belong in the model's validation. Other pieces of validation will belong more naturally to form field validation. So, I think you'll find that each piece of the validation mechanics will end up in only one place. This is actually a piece of work I want to get onto really soon, since it keeps coming up and we keep saying we're going to fix it. It isn't that hard, since Adrian did most of the hard work early last year. I have a couple of other things to do first, but it might be something I can get mostly done before OSCON and then smack it around with some of the people there a bit, too (as well as the no-doubt endless mailing list threads). Regards, Malcolm -- Monday is an awful way to spend 1/7th of your life. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
