API support for id args for documents & objects (#4519)

This commit is contained in:
shamoon
2023-11-06 12:31:10 -08:00
committed by GitHub
parent 95ab3b99f8
commit 73cbf6c33d
2 changed files with 120 additions and 12 deletions

View File

@@ -21,19 +21,38 @@ DATE_KWARGS = ["year", "month", "day", "date__gt", "gt", "date__lt", "lt"]
class CorrespondentFilterSet(FilterSet):
class Meta:
model = Correspondent
fields = {"name": CHAR_KWARGS}
fields = {
"id": ID_KWARGS,
"name": CHAR_KWARGS,
}
class TagFilterSet(FilterSet):
class Meta:
model = Tag
fields = {"name": CHAR_KWARGS}
fields = {
"id": ID_KWARGS,
"name": CHAR_KWARGS,
}
class DocumentTypeFilterSet(FilterSet):
class Meta:
model = DocumentType
fields = {"name": CHAR_KWARGS}
fields = {
"id": ID_KWARGS,
"name": CHAR_KWARGS,
}
class StoragePathFilterSet(FilterSet):
class Meta:
model = StoragePath
fields = {
"id": ID_KWARGS,
"name": CHAR_KWARGS,
"path": CHAR_KWARGS,
}
class ObjectFilter(Filter):
@@ -128,6 +147,7 @@ class DocumentFilterSet(FilterSet):
class Meta:
model = Document
fields = {
"id": ID_KWARGS,
"title": CHAR_KWARGS,
"content": CHAR_KWARGS,
"archive_serial_number": INT_KWARGS,
@@ -159,15 +179,6 @@ class LogFilterSet(FilterSet):
fields = {"level": INT_KWARGS, "created": DATE_KWARGS, "group": ID_KWARGS}
class StoragePathFilterSet(FilterSet):
class Meta:
model = StoragePath
fields = {
"name": CHAR_KWARGS,
"path": CHAR_KWARGS,
}
class ShareLinkFilterSet(FilterSet):
class Meta:
model = ShareLink