title: Django 2.0, First Level Class View, AttributeError: 'str' object has no attribute 'values'
body: <p>I have created a generic view and serializer in Django 2.0, so that I don't have to repeat my self, creating CRUD views or serializers.</p>
  
  <p>My views.py file of my API app</p>
  
  <pre><code>from rest_framework import generics, mixins
  from rest_framework.serializers import ModelSerializer
  
  
  class StandardListMixinCreateApiView(mixins.CreateModelMixin, generics.ListAPIView):
      def post(self, request, *args, **kwargs):
          return self.create(request, *args, **kwargs)
  
  
  class StandardRudApiView(generics.RetrieveUpdateDestroyAPIView):
      lookup_field = 'pk'
  </code></pre>
  
  <p>This function sets The <code>serializer.Meta.model</code> of each enabled model.
  The `cls parameter is one of the StandardApiViews.</p>
  
  <pre><code>def get_adapted_class(cls, model_class, serializer_fields='__all__'):
  
      class AdaptedSerializer(ModelSerializer):
          class Meta:
              model = model_class
  
          fields = serializer_fields
  
      class AdaptedView(cls):
          model = model_class.__name__
          queryset = model_class.objects.all()
          serializer_class = AdaptedSerializer
  
      return AdaptedView
  </code></pre>
  
  <p>My urls.py</p>
  
  <pre><code>from django.urls import re_path
  from .views import *
  from django.contrib.auth.models import Group, Permission
  from .models import *
  
  app_name = "api"
  </code></pre>
  
  <p>The models for which CRUD views get generated.</p>
  
  <pre><code>ENABLEDMODELS = [
      Address,
      Group,
      Permission,
      Customer,
      Employee,
      Commission,
      BugReport,
      FeatureRequest,
  ]
  
  APILISTVIEWS = [get_adapted_class(
      StandardListMixinCreateApiView,
      model) for model in ENABLEDMODELS]
  
  APIRUDVIEWS = [get_adapted_class(
      StandardRudApiView,
      model) for model in ENABLEDMODELS]
  </code></pre>
  
  <p>Adds an url route for each created ListView to the <code>urlpatterns</code> </p>
  
  <pre><code># List, create views
  urlpatterns = [re_path(
      f'^(?i){class_view.model}/',
      class_view.as_view(),
      name=f'{class_view.model}-list') for class_view in APILISTVIEWS]
  
  # Retrive, update, delete views
  urlpatterns += [re_path(
      f'^(?i){class_view.model}/' + r'(?P&lt;pk&gt;\d+)',
      class_view.as_view(),
      name=f'{class_view.model}-rud') for class_view in APIRUDVIEWS]
  </code></pre>
  
  <p>Error Messages</p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://localhost:8000/api/address/
  
  Django Version: 2.0.4
  Python Version: 3.6.5
  Installed Applications:
  ['django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'rest_framework',
  'api']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
  35.             response = get_response(request)
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
  158.                 response = self.process_exception_by_middleware(e, request)
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
  156.                 response = response.render()
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\response.py" in render
  106.             self.content = self.rendered_content
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\response.py" in rendered_content
  72.         ret = renderer.render(self.data, accepted_media_type, context)
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\renderers.py" in render
  724.         context = self.get_context(data, accepted_media_type, renderer_context)
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\renderers.py" in get_context
  656.         raw_data_post_form = self.get_raw_data_form(data, view, 'POST', request)
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\renderers.py" in get_raw_data_form
  572.                 data = serializer.data.copy()
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py" in data
  560.         ret = super(Serializer, self).data
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py" in data
  266.                 self._data = self.get_initial()
  
  File "C:\Users\Steffen22\AppData\Local\Programs\Python\Python36\lib\site-packages\rest_framework\serializers.py" in get_initial
  413.             for field in self.fields.values()
  
  Exception Type: AttributeError at /api/address/
  Exception Value: 'str' object has no attribute 'values'
  </code></pre>