LilyFoote/rest-framework-generic-relations

UnboundLocalError

Opened this issue · 2 comments

I'm getting this error :UnboundLocalError at /comments/

local variable 'serializer' referenced before assignment and I don't know why. Here's the traceback:

Traceback:
File "/root/python/django-zack/local/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/core/handlers/base.py" in get_response

  1.             response = response.render()
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/Django-1.6.2-py2.7.egg/django/template/response.py" in render
  2.         self.content = self.rendered_content
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/response.py" in rendered_content
  3.     ret = renderer.render(self.data, media_type, context)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/renderers.py" in render
  4.     context = self.get_context(data, accepted_media_type, renderer_context)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/renderers.py" in get_context
  5.     raw_data_post_form = self.get_raw_data_form(view, 'POST', request)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/renderers.py" in get_raw_data_form
  6.             content = renderer.render(serializer.data, accepted, context)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/serializers.py" in data
  7.             self._data = self.to_native(obj)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/rest_framework/serializers.py" in to_native
  8.         value = field.field_to_native(obj, field_name)
    
    File "/root/python/django-zack/local/lib/python2.7/site-packages/generic_relations/relations.py" in field_to_native
  9.     return serializer.to_native(value)
    

Exception Type: UnboundLocalError at /comments/
Exception Value: local variable 'serializer' referenced before assignment.
Does anyone else have this issue? If so how did you solve it?

Sorry about the very late reply. Is this still an issue for you?

If this is still an issue on v1.0.0, please open a new issue.