Well after finally getting some spare time I have created a patch
which validates all admin options. I have attached the patch to ticket
#3222. **NOTE** this is for the newforms-admin branch.

http://code.djangoproject.com/ticket/3222

I marked it as design decision needed as I changed a bit more then
what I originally planned with this ticket. Since there is a push or
desire to break the admin class out of the model definition I thought
it would be a good idea to move the validation to the ModelAdmin
class. I added a hook for validate_options which is called in __init__
I thought it was logical enough to do but does not necessary need to
be in __init__. Then in the core.management.get_validation_errors I
instantiate the ModelAdmin class and return any errors found. So the
errors in the admin options will still show when you run manage.py
validate like they do now.

I attempted to clean up the logic a bit and added a few more test
cases to make sure everything was validated properly. One thing you'll
notice is a few lambda statements which add the errors. These help to
standardize the error messages and make the code a bit nicer. Of
course the validation is still very complex and there are inevitably
things or uses I have missed. Please have a look and let me know what
you think or if anyone has any better ideas to accomplish the same
task.

Thanks!
Robert


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to