X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c0a7799619e217e2eac724b1a688ad37f0182253..8885fd14f5f040eb3aa69f1d705856f99a1fa572:/src/api/fields.py diff --git a/src/api/fields.py b/src/api/fields.py index b6269da16..cdfcc4735 100644 --- a/src/api/fields.py +++ b/src/api/fields.py @@ -1,5 +1,5 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from rest_framework import serializers from sorl.thumbnail import default @@ -17,7 +17,7 @@ class AbsoluteURLField(serializers.ReadOnlyField): if view_args: for v in view_args: fields = v.split(':', 1) - self.view_args[fields[0]] = fields[1] if len(fields)>1 else fields[0] + self.view_args[fields[0]] = fields[1] if len(fields) > 1 else fields[0] def to_representation(self, value): if self.view_name is not None: @@ -29,7 +29,7 @@ class AbsoluteURLField(serializers.ReadOnlyField): return self.context['request'].build_absolute_uri(value) -class LegacyMixin(object): +class LegacyMixin: def to_representation(self, value): value = super(LegacyMixin, self).to_representation(value) non_null_fields = getattr(getattr(self, 'Meta', None), 'legacy_non_null_fields', [])