On Wed, Sep 1, 2010 at 6:41 PM, Gregor Müllegger <gre...@muellegger.de> wrote: > I ran into the same problem as George before. And it always hits when I try to > modify my admin pages in undocumented ways. So I would also be for some > changes in this area. > > But I think we cannot simply remove it. Most constraints make much sense and > usually help avoiding problems in your admin pages. I'm also quite sure that > all these validation things help Django beginners to not run into errors with > messages that cannot be understand. > > > I've not looked into the validation code yet, but I assume that the validation > takes place as soon as you register your ModelAdmin with admin.site.register. > > Maybe its worth to introduce a parameter here to disable the sanity checks: > > admin.site.register(ModelAdmin, Model, validate=False)
I'm not really in favor of removing validation. The validation serves a very useful purpose for the vast majority of users, and duck typing doesn't mean you can't (or shouldn't) check that the argument that has been provided actually can quack in the appropriate way on demand. I'm also not wild about the idea of a simple flag to disable validation -- that seems like a very big hammer to use when the problem is ultimately with a couple of attributes on any given ModelAdmin. However, I can see the benefit in: * Improving the existing validation checks so that they are more tolerant of data that presented as a properties instead of attributes * Refactoring the validation code so that end-users can easily write their own validators (or overwrite existing validators) on a per-attribute basis. I haven't given much thought to what this would look like, but analogies with clean_FOO() on forms would seem appropriate. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.