from cProfile import label
import django_filters

from generic.models import UserGrades


from django.contrib.auth.models import User


class UserListFilter(django_filters.FilterSet):

    userprofile__grade = django_filters.ModelChoiceFilter(
        label="Grade", queryset=UserGrades.objects.all()
    )
    # test2 = django_filters.CharFilter()

    class Meta:
        model = User
        fields = {
            "username": ["contains"],
            "email": ["contains"],
            "userprofile__grade": ["exact"],
            "userprofile__peninsula_trainee": ["exact"],

        }

    # def __init__(self, data=None, queryset=None, *, request=None, prefix=None):
    #    super().__init__(data, queryset, request=request, prefix=prefix)
    #    self.filters["userprofile__grade"].label == "Grade"
