django rest framework model code example

Example 1: django rest framework

pip install djangorestframework
pip install markdown       # Markdown support for the browsable API.
pip install django-filter  # Filtering support

Example 2: django rest framework

$ pipenv install djangorestframework
# or
pip install djangorestframework

Example 3: drf serializer

serializer = CommentSerializer(data={'email': 'foobar', 'content': 'baz'})
serializer.is_valid()
# False
serializer.errors
# {'email': ['Enter a valid e-mail address.'], 'created': ['This field is required.']}