I have made a custom user model,by referring the tutorial , this is how I serialize the new user model:
Serializers.py
from django.conf import settings
User = settings.AUTH_USER_MODEL
class UserSerializer(serializers.ModelSerializer):
post = serializers.PrimaryKeyRelatedField(many=True, queryset=Listing.objects.all())
class Meta(object):
model = User
fields = ('username', 'email','post')
Views.py
from django.conf import settings
User = settings.AUTH_USER_MODEL
class UserList(generics.ListAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer
But when I tried to use this serializer,I get
'str' object has no attribute '_meta'
What did I do wrong?