Re: list display based on logged-in user

2010-07-17 Thread raj
Sorry for the trouble. ModelAdmin by default has an attribute named 'action_checkbox' in list_display to show the checkbox in each result row. On overridding we've excluded it. * You may change your code as list_display = ['action_checkbox'] + list(list_display). * Or better forget it by setting l

Re: list display based on logged-in user

2010-07-17 Thread raj
Re-posting the reply since the 1st didn't appear here: This happens because We've excluded 'action_checkbox', an item put by the ModelAdmin by default, from list_display. * Rewrite the prev code so as to include 'action_checkbox' also to list_display * OR just leave it to ModelAdmin. You'll first

Re: list display based on logged-in user

2010-07-15 Thread rahul jain
nope there is a problem after overriding it, i cannot see the check boxes now. One which is used for performing admin actions, even though i can see all the admin actions. If I uncomment the CustomAdmin then i am able to see the select boxes on the individual rows as well as "select all". What cou

Re: list display based on logged-in user

2010-07-09 Thread rahul jain
yup that's 100% correct :) Rahul On Fri, Jul 9, 2010 at 10:27 AM, raj wrote: > You are trying to override change_view instead of changelist_view. > Otherwise your approach must work. > class CustomAdmin(admin.ModelAdmin): >    def changelist_view(whatever_args_are_here): >        if condition: >

Re: list display based on logged-in user

2010-07-09 Thread raj
You are trying to override change_view instead of changelist_view. Otherwise your approach must work. class CustomAdmin(admin.ModelAdmin): def changelist_view(whatever_args_are_here): if condition: self.list_display = custom_list return super(CustomAdmin, self).ch

Re: list display based on logged-in user

2010-07-08 Thread rahul jain
anyone on this ? On Thu, Jul 8, 2010 at 11:56 AM, rahul jain wrote: > I am not sure what I am doing wrong but this should work > > class TestAdmin(admin.ModelAdmin): > >        list_display = (field1, field2, field3, fileld4, field5,field6) > > > class CustomTestAdmin(TestAdmin): > >        custo

Re: list display based on logged-in user

2010-07-08 Thread rahul jain
I am not sure what I am doing wrong but this should work class TestAdmin(admin.ModelAdmin): list_display = (field1, field2, field3, fileld4, field5,field6) class CustomTestAdmin(TestAdmin): custom_list_display = (field1, field2, field3) # showing less number of fields

Re: list display based on logged-in user

2010-07-08 Thread derek
On Jul 7, 11:40 pm, rahul jain wrote: > Hi there ! > > I would like to display model fields based on the logged-in user. > > If user is restricted user > > list_display = (field1, field2) > > else > > list_display = (field1, field2, field3, field4) > > How is it possible ? > Also see: http://stac

Re: list display based on logged-in user

2010-07-07 Thread raj
Try overriding changelist_view of your ModelAdmin. Reset self.list_display based on user and then call the super method changelist_view. Rajeesh. On Jul 8, 2:40 am, rahul jain wrote: > I would like to display model fields based on the logged-in user. > How is it possible ? -- You received thi

list display based on logged-in user

2010-07-07 Thread rahul jain
Hi there ! I would like to display model fields based on the logged-in user. If user is restricted user list_display = (field1, field2) else list_display = (field1, field2, field3, field4) How is it possible ? --RJ -- You received this message because you are subscribed to the Google Group