0

I've created a custom FieldListFilter for my site's admin for whether modeltranslation translations are available for a field.

It creates a filter that currently looks like this on the sidebar:

The "Lacks English" option adds vt_title_en__exact= to the query string.

I would like to also implement a "Has English" which does the opposite filter. Can I do that with a django admin site url query strings?

Btw: source for my custom filter: https://github.com/yairchu/azlemi/blob/master/vote/admin.py#L30

yairchu
  • 23,680
  • 7
  • 69
  • 109

2 Answers2

4

I think vt_title_en__gt= can do the job. Any non-empty string is greater than "".

catavaran
  • 44,703
  • 8
  • 98
  • 85
0

You should create queryset method for do it, because there is no such possibility to put exclusion or negation into expected_parameters.

GwynBleidD
  • 20,081
  • 5
  • 46
  • 77