On Sun, Jul 19, 2009 at 5:07 PM, Some Guy<djul...@gmail.com> wrote: > > Thanks for the help :-) > > overriding queryset in modeladmin worked for the filtering. > > as for the subclassing of the model.. > > I've basically got a table with lots of columns ex.[a,b,c,d,e,f,g...] > I would like to have one admin page show a,b,c,d and another that > shows a,b,c,f,g based (ideally) on a boolean column in the table. > > If anyone has a quick idea on how to accomplish that one i would be > most appreciative. > > > > > > > > On Jul 19, 12:53 pm, jeff <jmsche...@gmail.com> wrote: >> I'm not entirely clear what you're trying to accomplish, but in >> general when I hear "dummy" anything, I have to think there's a better >> solution. Perhaps what you're looking for is an abstract model class, >> from which you can subclass your two concrete ones? >> Seehttp://docs.djangoproject.com/en/dev/topics/db/models/#id6. >> >> If you really need to restrict the queryset for the model admin's list >> page, then yes, you can override the default queryset method defined >> in ModelAdmin just as the link describes. >> >> jeff >> >> On Jul 19, 12:40 pm, Some Guy <djul...@gmail.com> wrote: >> >> >> >> > hrmm, I found this >> > too..http://blog.dougalmatthews.com/2008/10/filter-the-django-modeladmin-set/ >> >> > the method used is def queryset(self, request): in the model admin >> > class... >> > This method is not in the docs, though. >> >> > Should any of these methods be preferred over the others? >> > any advice is appreciated :-) >> >> > On Jul 19, 12:17 pm, Some Guy <djul...@gmail.com> wrote: >> >> > > I was wondering if it's possible to have an admin page always show a >> > > filtered (or other non-default) queryset? >> >> > > i.e. I would like the default admin page to show a queryset without >> > > any rows that have a particular boolean field set to false. >> >> > > I've looked in the admin views.py, but haven't found anything that >> > > looks possible. >> >> > > I just need to know if it's possible, and where to look... >> >> > > TIA >> >> > > (longer version follows) >> > > I have a Model that I would like to display with two different >> > > list_displays, based on whether a boolean is true or false. >> >> > > I've noticed that any model inherited with no additional fields >> > > specified shows up in the parent model's admin page listing. I was >> > > going to exploit this to make a dummy subclass of the model superclass >> > > with a different list_display and register that with the adminsite. >> > > Not sure if there is an easy way to do this, but who knows :-> there's >> > > lots of django tricks. > > >
If you're on the latest development version of Django 1.1 beta I'd make proxy subclasses on the model and register separate model admins for each of them. Alex -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Voltaire "The people's good is the highest law." -- Cicero "Code can always be simpler than you think, but never as simple as you want" -- Me --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---