X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3fceb197b7f492cf5cfcb4034b6e045638f128d4..224e9f9ea36a6c39466fdb13cbc8c06bedfe8c76:/src/api/fields.py?ds=inline diff --git a/src/api/fields.py b/src/api/fields.py index 278af6aea..d1f9da4bf 100644 --- a/src/api/fields.py +++ b/src/api/fields.py @@ -3,7 +3,7 @@ # from rest_framework import serializers from sorl.thumbnail import default -from django.core.urlresolvers import reverse +from django.urls import reverse from club.models import Membership @@ -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', [])