Refactor Graphql

This commit is contained in:
Lorenz Padberg 2024-04-09 14:22:49 +02:00
parent 6d920c2358
commit 026db8156a
1 changed files with 3 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# mysite/api/graphene_wagtail.py
# Taken from https://github.com/patrick91/wagtail-ql/blob/master/backend/graphene_utils/converter.py and slightly adjusted
import logging
from wagtail.images.views.serve import generate_image_url
from graphene.types import Scalar
from graphene_django.converter import convert_django_field
from graphql_relay import to_global_id
@ -48,10 +48,9 @@ def augment_fields(raw_data):
_type = data['type']
if _type == 'image_block':
_value = data['value']
image = Image.objects.get(id=_value)
value = {
# 'value': _value,
# 'id': d['id'],
'path': Image.objects.get(id=_value).file.url
'path': generate_image_url(image, 'original'),
}
data['value'] = value
if _type == 'assignment':