From a2246c84d1f12d26abae555126d194cd9ad260cd Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 29 Feb 2024 11:42:52 +0000 Subject: [PATCH] Updated documentation --- _modules/apis_core/generic/api_views.html | 11 ++++++----- _modules/apis_core/generic/serializers.html | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/_modules/apis_core/generic/api_views.html b/_modules/apis_core/generic/api_views.html index ba51d4243..97405e93b 100644 --- a/_modules/apis_core/generic/api_views.html +++ b/_modules/apis_core/generic/api_views.html @@ -90,7 +90,7 @@

Source code for apis_core.generic.api_views

 from rest_framework import viewsets
-from .serializers import serializer_factory
+from .serializers import serializer_factory, GenericHyperlinkedModelSerializer
 from .helpers import first_match_via_mro
 
 
@@ -124,10 +124,11 @@ 

Source code for apis_core.generic.api_views

 
[docs] def get_serializer_class(self): - serializer_class = first_match_via_mro( - self.model, path="serializers", suffix="Serializer" - ) or serializer_factory(self.model) - return serializer_class
+ serializer_class = ( + first_match_via_mro(self.model, path="serializers", suffix="Serializer") + or GenericHyperlinkedModelSerializer + ) + return serializer_factory(self.model, serializer=serializer_class)
diff --git a/_modules/apis_core/generic/serializers.html b/_modules/apis_core/generic/serializers.html index d4587633d..fdb7d03cc 100644 --- a/_modules/apis_core/generic/serializers.html +++ b/_modules/apis_core/generic/serializers.html @@ -147,7 +147,9 @@

Source code for apis_core.generic.serializers

def serializer_factory( model, serializer=GenericHyperlinkedModelSerializer, fields="__all__", **kwargs ): - meta = type(str("Meta"), (object,), {"model": model, "fields": fields}) + defaultmeta = type(str("Meta"), (object,), {"fields": fields}) + meta = getattr(serializer, "Meta", defaultmeta) + meta.model = model serializer = type( str("%sModelSerializer" % model._meta.object_name), (serializer,),