mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Change: treat created as date not datetime (#9793)
This commit is contained in:
@@ -48,6 +48,15 @@ CHAR_KWARGS = ["istartswith", "iendswith", "icontains", "iexact"]
|
||||
ID_KWARGS = ["in", "exact"]
|
||||
INT_KWARGS = ["exact", "gt", "gte", "lt", "lte", "isnull"]
|
||||
DATE_KWARGS = [
|
||||
"year",
|
||||
"month",
|
||||
"day",
|
||||
"gt",
|
||||
"gte",
|
||||
"lt",
|
||||
"lte",
|
||||
]
|
||||
DATETIME_KWARGS = [
|
||||
"year",
|
||||
"month",
|
||||
"day",
|
||||
@@ -731,6 +740,19 @@ class DocumentFilterSet(FilterSet):
|
||||
|
||||
mime_type = MimeTypeFilter()
|
||||
|
||||
# Backwards compatibility
|
||||
created__date__gt = Filter(
|
||||
field_name="created",
|
||||
label="Created after",
|
||||
lookup_expr="gt",
|
||||
)
|
||||
|
||||
created__date__lt = Filter(
|
||||
field_name="created",
|
||||
label="Created before",
|
||||
lookup_expr="lt",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Document
|
||||
fields = {
|
||||
@@ -739,8 +761,8 @@ class DocumentFilterSet(FilterSet):
|
||||
"content": CHAR_KWARGS,
|
||||
"archive_serial_number": INT_KWARGS,
|
||||
"created": DATE_KWARGS,
|
||||
"added": DATE_KWARGS,
|
||||
"modified": DATE_KWARGS,
|
||||
"added": DATETIME_KWARGS,
|
||||
"modified": DATETIME_KWARGS,
|
||||
"original_filename": CHAR_KWARGS,
|
||||
"checksum": CHAR_KWARGS,
|
||||
"correspondent": ["isnull"],
|
||||
@@ -764,8 +786,8 @@ class ShareLinkFilterSet(FilterSet):
|
||||
class Meta:
|
||||
model = ShareLink
|
||||
fields = {
|
||||
"created": DATE_KWARGS,
|
||||
"expiration": DATE_KWARGS,
|
||||
"created": DATETIME_KWARGS,
|
||||
"expiration": DATETIME_KWARGS,
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user