mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Fix: type casting of db values for shared by me filter (#5155)
This commit is contained in:
parent
05e294fc81
commit
cf869b1356
@ -1,7 +1,9 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models import CharField
|
||||
from django.db.models import Count
|
||||
from django.db.models import OuterRef
|
||||
from django.db.models import Q
|
||||
from django.db.models.functions import Cast
|
||||
from django_filters.rest_framework import BooleanFilter
|
||||
from django_filters.rest_framework import Filter
|
||||
from django_filters.rest_framework import FilterSet
|
||||
@ -119,7 +121,7 @@ class SharedByUser(Filter):
|
||||
num_shared_users=Count(
|
||||
UserObjectPermission.objects.filter(
|
||||
content_type=ctype,
|
||||
object_pk=OuterRef("pk"),
|
||||
object_pk=Cast(OuterRef("pk"), CharField()),
|
||||
).values("user_id"),
|
||||
),
|
||||
)
|
||||
@ -127,7 +129,7 @@ class SharedByUser(Filter):
|
||||
num_shared_groups=Count(
|
||||
GroupObjectPermission.objects.filter(
|
||||
content_type=ctype,
|
||||
object_pk=OuterRef("pk"),
|
||||
object_pk=Cast(OuterRef("pk"), CharField()),
|
||||
).values("group_id"),
|
||||
),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user