Wednesday, May 25, 2011

Re: Hidden rows elements also visible on list filters

Yes I am referring to django admin list filter, one on the side.


class <model_name>Admin(model.Admin):

list_filter = (column1, column2)


so for instance column1 has 6 values (a, b,b,b,c,e). Then list filter shows a,b, c,e. 

like this

By column1

show all
a
b
c
e

Now if i hide some rows based on the logged in user and reduce the number of queries to  4 values (a,c).
But instead what i see is this same as with no hidden rows ie.

By column1

show all
a
b
c
e

The expected result which I would like to see is this

By column1

show all
a
c

Please let me know how to solve this problem.

Thanks.

RJ



 




On Wed, May 4, 2011 at 10:06 PM, Andy McKay <andy@clearwind.ca> wrote:
> problem is that few rows i have disabled.
> But list filter still displays those rows as well.

Are you using the built in django admin, or something else?
By "disabled" what do you mean, a change in the model or something else?

Until you give us a bit more information, we are unlikely to be able to help. But here's a bet:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter

The example for DecadeBornListFilter shows how you can define a custom queryset and perhaps this will allow you to filter out disabled rows.
--
 Andy McKay
 andy@clearwind.ca
 twitter: @andymckay


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment