-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
After reading through #1249 and #1550 , I got the quickstart example working w/ 3.0. serializers.py looks like this now:
from django.contrib.auth.models import User, Group
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
lookup_field = 'username'
fields = ('username', 'email')
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
lookup_field = 'name'
fields = ('name')
Note that I removed the url and groups fields and added lookup_field from the source included in the quickstart tutorial on django-rest-framework.org. This works for the following URLs:
localhost/tutorial/quickstart/
localhost/tutorial/quickstart/users
localhost/tutorial/quickstart/users/1
But I haven't had any luck getting the groups api to work:
localhost/tutorial/quickstart/groups
localhost/tutorial/quickstart/groups/1
I get the following exception for both groups and groups/1
ImproperlyConfigured at /quickstart/groups/
Field name n is not valid for model ModelBase.
I've added user, groups, etc. with the Django admin console.
Metadata
Metadata
Assignees
Labels
No labels