class AccessRightsFilter(filters.FilterSet):
class Meta:
model = AccessRights
fields = (
"description",
"access_type__url",
"access_type__pref_label",
"license__url",
"license__pref_label",
)
description = filters.CharFilter(
field_name="description__values",
max_length=255,
lookup_expr="icontains",
label="description",
)
access_type__url = filters.CharFilter(
max_length=512,
lookup_expr="icontains",
label="access_type__url",
)
access_type__pref_label = filters.CharFilter(
field_name="access_type__pref_label__values",
max_length=255,
lookup_expr="icontains",
label="access_type__pref_label",
)
license__url = filters.CharFilter(
max_length=512,
lookup_expr="icontains",
label="license__url",
)
license__pref_label = filters.CharFilter(
field_name="license__pref_label__values",
max_length=255,
lookup_expr="icontains",
label="license__pref_label",
)
ordering = filters.OrderingFilter(
fields=(
("created", "created"),
("modified", "modified"),
("description__values", "description"),
("access_type__url", "access_type__url"),
("access_type__pref_label__values", "access_type__pref_label"),
("license__url", "license__url"),
("license__pref_label__values", "license__pref_label"),
)
)