File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -348,19 +348,18 @@ class Serializer(BaseSerializer, metaclass=SerializerMetaclass):
348
348
'invalid' : _ ('Invalid data. Expected a dictionary, but got {datatype}.' )
349
349
}
350
350
351
- @property
351
+ @cached_property
352
352
def fields (self ):
353
353
"""
354
354
A dictionary of {field_name: field_instance}.
355
355
"""
356
356
# `fields` is evaluated lazily. We do this to ensure that we don't
357
357
# have issues importing modules that use ModelSerializers as fields,
358
358
# even if Django's app-loading stage has not yet run.
359
- if not hasattr (self , '_fields' ):
360
- self ._fields = BindingDict (self )
361
- for key , value in self .get_fields ().items ():
362
- self ._fields [key ] = value
363
- return self ._fields
359
+ fields = BindingDict (self )
360
+ for key , value in self .get_fields ().items ():
361
+ fields [key ] = value
362
+ return fields
364
363
365
364
@cached_property
366
365
def _writable_fields (self ):
{"resolvedServerColorMode":"day"}
You can’t perform that action at this time.
0 commit comments