fix keyerror introduced by #3985
This commit is contained in:
parent
6c9fb713e1
commit
e09c5f415a
@ -13,6 +13,7 @@ class UsersAppConfig(AppConfig):
|
|||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
# Import all required stuff.
|
# Import all required stuff.
|
||||||
|
from . import serializers # noqa
|
||||||
from ..core.signals import post_permission_creation, permission_change
|
from ..core.signals import post_permission_creation, permission_change
|
||||||
from ..utils.rest_api import router
|
from ..utils.rest_api import router
|
||||||
from .projector import get_projector_elements
|
from .projector import get_projector_elements
|
||||||
|
@ -135,5 +135,13 @@ class RESTModelMixin:
|
|||||||
"""
|
"""
|
||||||
Returns the full_data of the instance.
|
Returns the full_data of the instance.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
serializer_class = model_serializer_classes[type(self)]
|
||||||
|
except KeyError:
|
||||||
|
# Because of the order of imports, it can happen, that the serializer
|
||||||
|
# for a model is not imported yet. Try to guess the name of the
|
||||||
|
# module and import it.
|
||||||
|
module_name = type(self).__module__.rsplit(".", 1)[0] + ".serializers"
|
||||||
|
__import__(module_name)
|
||||||
serializer_class = model_serializer_classes[type(self)]
|
serializer_class = model_serializer_classes[type(self)]
|
||||||
return serializer_class(self).data
|
return serializer_class(self).data
|
||||||
|
Loading…
Reference in New Issue
Block a user