> Excellent -- I'm excited that you're interested in helping out. The > best bet would be to submit patches against the newforms-admin, but > I'll give the caveat that I'm moving pretty quickly on this and may > duplicate your work. The last thing I want is for you to spend time on > a patch, only to have it be made redundant. > > How about this: Suggest some concrete changes you'd like to make, and > I'll try to avoid making those changes.
Well, first off I'd like to say that I think you are going in a very good direction with the ModelAdmin class and I would be happy to help out with anything I can. Since you would like to decouple the admin from the models I think it would be a good Idea to have the ModelAdmin do all the validation for the admin options. Currently they are in the django.core.management.get_validation_errors() which validates all of the model class. I would like to move them into the ModelAdmin and add the missing validators, then rewrite the test cases for invalid_admin_options accordingly. I guess the only issue would be when the validation would be called. My initial plan was to add a _validate_FOO() for each option and then have a method ModelAdmin.validate() which would call all of them. My alternative plan which I like better is to add get_FOO() for each option which would both validate and return the option. Then we could rewrite the various views to use this get method instead of self.FOO, now I know this adds a little overhead to an otherwise straight forward operation. But, an added benefit would be the ModelAdmin could be self healing, say you declare list_display with a bunch of fields then spell a field name wrong, which I do all the time :) get_list_display() would just simply remove the bad fieldname with a warning and return the otherwise good list. That way instead of getting a 500 error or an ugly traceback you get a list minus the bad field or the default option. Another obvious benefit is that when you define the ModelAdmin for you class you could provide your own get_FOO() to make your ModelAdmin dynamic or user customizable. For example I would like to have an application where users can select which fields to display in the list, since everyone has his/her own tastes, with my get_FOO() I could store each users preference in a cookie or the DB. I'm not 100% on combining the validation into the get method, so any input would be excellent or if anyone has any better ideas. I will start working on just writing the validation methods since they could be easily turned into the get methods I'm proposing. Then If no one else likes the idea I wont go down that path. Robert Adrian > > -- > Adrian Holovaty > holovaty.com | djangoproject.com > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---