title: DRF - Render Model Serializer to HTML Create Form
body: <p>I am trying to render a form to create new objects. I have defined my API in a separate App and now I want to use it in another App of the same project. I followed the Tutorial and now I have a a Default Router, a ModelSerializer and a ModelViewSet and an automatically created browseable HTML API which also automatically renders a HTML form on the list page, to create new objects. I want to include this form now in my project. 
  Of course I could write a form by myself and just use jQuery to make a POST request to the API but then I will have to create a form for every model manually. And if the model changes I will have to update the form. I was hoping to accomplish this using DRF and the documentation found here:
  <a href="http://www.django-rest-framework.org/topics/html-and-forms/" rel="nofollow">http://www.django-rest-framework.org/topics/html-and-forms/</a></p>
  
  <p>Sadly I have not found any example on the internet. I did find one Question on StackOverflow with the same problem but no solution.</p>
  
  <p><strong>class TaskViewSet(viewsets.ModelViewSet):</strong> (in API/views.py)</p>
  
  <pre><code>serializer_class = TaskSerializer
  permission_classes = (permissions.IsAuthenticated,)
  
  def get_queryset(self):
      return Question.objects.all().filter(owner=self.request.user.institute)
  
  def list(self, request):
      serializer = TaskSerializer(self.get_queryset(), many=True)
      return Response(serializer.data)
  
  def perform_create(self, serializer):
      serializer.save(owner=self.request.user.institute, created_by=self.request.user, modified_by=self.request.user)
  
  def perform_update(self, serializer):
      serializer.save(owner=self.request.user.institute, modified_by=self.request.user)
  </code></pre>
  
  <p><strong>class TaskSerializer(serializers.ModelSerializer):</strong> (in API/serializers.py)</p>
  
  <pre><code>owner = serializers.ReadOnlyField(source='owner.name')
  created_by = serializers.ReadOnlyField(source='created_by.username')
  modified_by = serializers.ReadOnlyField(source='modified_by.username')
  class Meta:
      model = Question
  </code></pre>
  
  <p>In <strong>urls.py</strong> I use the default router and add this:</p>
  
  <pre><code>router.register(r'questions', views.TaskViewSet, 'question')
  </code></pre>
  
  <p>Now, in my other App (same project), I want to have a create form, so I added this code to the template:</p>
  
  <pre><code>            &lt;form action="{% url 'api:question-list' %}" method="POST"&gt;
                  {% csrf_token %}
                  {% render_form serializer template_pack='rest_framework/vertical' %}
                  &lt;input type="submit" value="Save"&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>Sadly I get an error now that does not help me at all when trying to access that website.   </p>
  
  <p><strong>'str' object has no attribute 'data'</strong></p>
  
  <p>I have tried to add fields for <strong>renderer_classes</strong> to my ModelViewSet, but then my browse-able API breaks and is not useable anymore. I just want to include the form that is rendered at the bottom of the screenshot. Is this possible or do I really have to build it manually?</p>
  
  <p><img src="https://dl.dropboxusercontent.com/u/995558/Screen%20Shot%202016-09-23%20at%2016.22.08.png" alt="1"></p>