feat: add users and groups API routes

This commit is contained in:
Kaaybi
2022-11-12 18:46:52 +00:00
committed by Michael Shamoon
parent 96a29883cd
commit 4333bd58cf
8 changed files with 175 additions and 0 deletions

20
src/paperless/filters.py Normal file
View File

@@ -0,0 +1,20 @@
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
from django_filters.rest_framework import FilterSet
CHAR_KWARGS = ["istartswith", "iendswith", "icontains", "iexact"]
ID_KWARGS = ["in", "exact"]
INT_KWARGS = ["exact", "gt", "gte", "lt", "lte", "isnull"]
DATE_KWARGS = ["year", "month", "day", "date__gt", "gt", "date__lt", "lt"]
class UserFilterSet(FilterSet):
class Meta:
model = User
fields = {"username": CHAR_KWARGS}
class GroupFilterSet(FilterSet):
class Meta:
model = Group
fields = {"name": CHAR_KWARGS}