                  source = self.source or field_name
                  queryset = obj
                  for component in source.split('.'):
                      queryset = get_component(queryset, component)
  
              # Forward relationship
              if is_simple_callable(getattr(queryset, 'all', None)):
                  return [self.to_native(item.pk) for item in queryset.all()]
 
</s> remove         for k, v in serializer.get_fields().items():
            if getattr(v, 'read_only', True):
 </s> add         for key, val in data.fields.items():
            if getattr(val, 'read_only', True): </s> remove     def serializer_to_form_fields(self, serializer):
 </s> add     def data_to_form_fields(self, data): </s> remove     def _get_form(self, view, method, request):
        # We need to impersonate a request with the correct method,
        # so that eg. any dynamic get_serializer_class methods return the
        # correct form for each method.
        restore = view.request
        request = clone_request(request, method)
        view.request = request
        try:
            return self.get_form(view, method, request)
        finally:
            view.request = restore

    def _get_raw_data_form(self, view, method, request, media_types):
 </s> add     def _get_rendered_html_form(self, view, method, request): </s> remove         OnTheFlyForm = type(str("OnTheFlyForm"), (forms.Form,), fields)
        data = (obj is not None) and serializer.data or None
        form_instance = OnTheFlyForm(data)
 </s> add         fields = self.data_to_form_fields(data)
        DynamicForm = type(str('DynamicForm'), (forms.Form,), fields)
        data = None if data.empty else data </s> remove     def render(self, serializer, obj, request):
        fields = self.serializer_to_form_fields(serializer)
 </s> add     def render(self, data, accepted_media_type=None, renderer_context=None):
        self.renderer_context = renderer_context or {}
        request = renderer_context['request']
                    if queryset is None:
                        return []
                  source = self.source or field_name
                  queryset = obj
                  for component in source.split('.'):
                    if queryset is None:
                        return []
                      queryset = get_component(queryset, component)
  
              # Forward relationship
              if is_simple_callable(getattr(queryset, 'all', None)):
                  return [self.to_native(item.pk) for item in queryset.all()]
keep keep add keep keep keep keep keep
 Cleanup and dealing with empty form data. 
rest_framework/relations.py