Tuesday, June 5, 2012

Re:SOLVED Admin filter sidebar problem

Solved using custom filterspecs as said in:

http://djangosnippets.org/snippets/2261/



On 06/05/2012 07:27 PM, kooliah wrote:
> Here me again :-)
> I know that with django 1.4 there are custom filters, but i have to
> use 1.3 so....
>
> I have a model with a foreign key to another
>
> class mdl1(models.Model):
> color = models.ForeignKey(colors)
> name = models.CharField(_("name"),
>
> If in the admin.py i assign list_filter to color
>
> class mdl1Admin(admin.ModelAdmin):
> list_display = ('color','name')
> list_filter = ('color',)
>
>
> In the admin changeview filter sidebar it shows all the colors, not
> only those linked.
> for example:
>
> mdl1:
>
> red:jonh
> red:mike
> red:frank
> green:julia
> green:jack
>
>
> I would like to see in the sidebar only red and green not all the
> colors.....
>
> How can i do?
>
> Thanks to all
>
> Kooliah
>
>
>

--
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