Fixed a bug with type and python 2.x compat.

This commit is contained in:
Xavier Ordoquy 2012-12-02 01:24:15 +01:00
parent 73572bc199
commit d6b4a6b04a

View File

@ -382,7 +382,7 @@ class BrowsableAPIRenderer(BaseRenderer):
# Creating an on the fly form see:
# http://stackoverflow.com/questions/3915024/dynamically-creating-classes-python
OnTheFlyForm = type("OnTheFlyForm", (forms.Form,), fields)
OnTheFlyForm = type(str("OnTheFlyForm"), (forms.Form,), fields)
data = (obj is not None) and serializer.data or None
form_instance = OnTheFlyForm(data)
return form_instance