Skip to content
Snippets Groups Projects
Commit e3b718e9 authored by Deaktivert bruker's avatar Deaktivert bruker
Browse files

greg.api.filters: use explicit symbol imports

Mostly a visual improvement, but instead of importing the entire
django_filters.rest_framework module we make the dependency situation
clearer by importing specific symbols.

Fixes: GREG-20
parent 2ed338c4
No related branches found
No related tags found
1 merge request!26Heuristic for telling if guest is registered and verified
from django_filters import rest_framework as filters
from django_filters.rest_framework import (
BaseInFilter,
BooleanFilter,
FilterSet,
)
from greg.models import Person, PersonRole, PersonIdentity
from greg.models import (
Person,
PersonRole,
PersonIdentity,
)
class PersonRoleFilter(filters.FilterSet):
type = filters.BaseInFilter(field_name="role__type", lookup_expr="in")
class PersonRoleFilter(FilterSet):
type = BaseInFilter(field_name="role__type", lookup_expr="in")
class Meta:
model = PersonRole
fields = ["type"]
class PersonFilter(filters.FilterSet):
verified = filters.BooleanFilter(
class PersonFilter(FilterSet):
verified = BooleanFilter(
field_name="person__verified_by_id", lookup_expr="isnull", exclude=True
)
......@@ -21,7 +29,7 @@ class PersonFilter(filters.FilterSet):
fields = ["first_name", "last_name", "verified"]
class PersonIdentityFilter(filters.FilterSet):
class PersonIdentityFilter(FilterSet):
class Meta:
model = PersonIdentity
fields = ["type", "verified_by_id"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment