Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django REST Framework RESTful Django Model Serializers

Getting following exception while passing the serializer_obj.data to JSONRenderer.render() method.

JSONRenderer.render(course_se.data) Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: render() missing 1 required positional argument: 'data'

JSONRenderer.render(data=course_se.data)
Traceback (most recent call last):
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/commands/shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/django/core/management/commands/shell.py", line 61, in run_shell
raise ImportError
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: render() missing 1 required positional argument: 'self'

1 Answer

Sry. Instead of calling JSONRenderer().render(serializer_obj) i called the render method on JSONRenderer class itself. Resolved thanks.