def get_queryset(self):
queryset = super(MyModel, self).get_queryset()
states_filter = [
item.strip()
for item in config.STATES.split(',')
]
if not states_filter:
MyModel.objects.none()
q = Q()
for state in states_filter:
q = q | Q(status__iexact=state)
queryset = queryset.filter(q)
return queryset
essência relacionada: https://gist.github.com/ctrl-alt-delete/10745911