On 1/16/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > I'd like to take the clean route and move the admin definitions into a > separate file, or at least still in the models.py but not within the > models themselves. Of course, that's not as convenient as defining the > admin stuff directly within the model, but another solution would > require more typing and possible repetition.
...snip... > We'll have to discuss the tradeoff. It's an interesting conflict > between convenience and purity. If anybody wants to come up with > proposals for syntax, that'd be fantastic. Joseph and I were kicking around some ideas over lunch today, and one thing that seemed like a good idea was moving back to the old-school 'admin as Meta attribute'. Under this scheme, django.contrib.admin would define a default class for model administration. So you could do, say from django.contrib.admin.views import ModelAdmin class MyModel(models.Model): ... fields here ... class Meta: admin = ModelAdmin() And that would get the defaults. Keyword arguments passed to it could control traditional options like list_filter, search_fields, etc. Customization would come form subclassing ModelAdmin (or whatever it ends up being called). The only tricky bit is telling the ModelAdmin instance what model it's administering. I'm thinking maybe a 'model' attribute on the ModelAdmin instance which starts out None, and have the model metaclass go back and set it correctly once the model class exists. Does this sound useful at all? Am I on crack thinking we could go back to admin as a Meta attribute? -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---