On Fri, 2008-11-21 at 02:08 -0800, AndyB wrote: > I basically would like some way for staff users to choose which > columns are displaying in an object's changelist. > > So far I've got an ugly solution which I can actually have some idea > how to implement and the 'correct' solution which requires quite a lot > of digging in the django internals. > > The ugly solution is 'show everything and use jquery to control what > is displayed' > > The correct solution I imagine would involve altering the list_display > properties that are created when the app's admin.py is imported. > > Has anyone tried to do anything like this already?
I haven't tried it, but a couple of minutes looking at the code suggests it shouldn't be too hard. The admin display, by design, is a class-based setup, with particular methods you can override. If you look at the ModelAdmin.changelist_view() method -- which is the one responsible for the page you're interested in -- you'll see that it creates the page using information from attributes on "self". So you could override that method, set up self.list_display and self.list_display_links appropriately and then pass off control to the base class method. That's pretty much the intention of the admin system design: you override the methods you want to change, often just setting up the instance slightly differently before returning to the normal execution paths. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users?hl=en -~----------~----~----~----~------~----~------~--~---