Fix Image resize + Partial API fix
This commit is contained in:
parent
8c57eb8096
commit
b280647c35
2 changed files with 8 additions and 5 deletions
|
|
@ -114,7 +114,7 @@ class ImageForm(forms.Form):
|
|||
frame = frame.crop((x, y, x + w, y + h))
|
||||
frame = frame.resize(
|
||||
(settings.PIC_WIDTH, settings.PIC_RATIO * settings.PIC_WIDTH),
|
||||
Image.ANTIALIAS,
|
||||
Image.Resampling.LANCZOS,
|
||||
)
|
||||
frames.append(frame)
|
||||
|
||||
|
|
|
|||
|
|
@ -160,11 +160,13 @@ class ConsumerViewSet(ReadOnlyProtectedModelViewSet):
|
|||
"""
|
||||
|
||||
queryset = super().get_queryset().distinct()
|
||||
|
||||
# Sqlite doesn't support ORDER BY in subqueries
|
||||
queryset = queryset.order_by("name") \
|
||||
if settings.DATABASES[queryset.db]["ENGINE"] == 'django.db.backends.postgresql' else queryset
|
||||
|
||||
alias = self.request.query_params.get("alias", None)
|
||||
|
||||
# Check if this is a valid regex. If not, we won't check regex
|
||||
try:
|
||||
re.compile(alias)
|
||||
|
|
@ -180,7 +182,8 @@ class ConsumerViewSet(ReadOnlyProtectedModelViewSet):
|
|||
# then if the normalized pattern matches a normalized alias.
|
||||
queryset = queryset.filter(
|
||||
**{f'name{suffix}': alias_prefix + alias}
|
||||
).union(
|
||||
)
|
||||
""".union(
|
||||
queryset.filter(
|
||||
Q(**{f'normalized_name{suffix}': alias_prefix + Alias.normalize(alias)})
|
||||
& ~Q(**{f'name{suffix}': alias_prefix + alias})
|
||||
|
|
@ -191,12 +194,12 @@ class ConsumerViewSet(ReadOnlyProtectedModelViewSet):
|
|||
& ~Q(**{f'normalized_name{suffix}': alias_prefix + Alias.normalize(alias)})
|
||||
& ~Q(**{f'name{suffix}': alias_prefix + alias})
|
||||
),
|
||||
all=True)
|
||||
all=True)"""
|
||||
|
||||
queryset = queryset if settings.DATABASES[queryset.db]["ENGINE"] == 'django.db.backends.postgresql' \
|
||||
else queryset.order_by("name")
|
||||
|
||||
return queryset.distinct()
|
||||
return queryset#.distinct()
|
||||
|
||||
|
||||
class TemplateCategoryViewSet(ReadProtectedModelViewSet):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue