Skip to content

Commit abee91d

Browse files
Update djangocms_rest/serializers/plugins.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 256b2cd commit abee91d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

djangocms_rest/serializers/plugins.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ def to_representation(self, instance: CMSPlugin):
130130
ret[field.name] = serialize_fk(
131131
request,
132132
field.related_model,
133-
getattr(instance, field.name + "_id"),
134-
obj=getattr(instance, field.name)
135-
if field.is_cached(instance)
136-
else None,
133+
getattr(instance, f"{field.name}_id"),
134+
obj=(
135+
getattr(instance, field.name)
136+
if field.is_cached(instance)
137+
else None
138+
),
137139
)
138140
elif isinstance(field, JSON_FIELDS) and ret.get(field.name):
139141
# If the field is a subclass of JSONField, serialize its value directly

0 commit comments

Comments
 (0)