In swagger no parameters?

Hi all, I use svagger for the test API. My serializer
class UserSerializer(serializers.ModelSerializer):
 password = serializers.CharField(write_only=True)
 email = serializers.CharField(max_length=100)

 class Meta:
 model = User
 fields = (
'phone',
'shipping_address',
'paypal_address',
'ebay_id',
'resellers_permit_number',
'tracking_cards',
'sold_cards',
'objects',
'email',
'password',
)

 def create(self, validated_data):
 # user = User.objects.create_user(**validated_data)
 # user = User.objects.create(
 # username=validated_data['username']
 # )
 # user.set_password(validated_data['password'])
 user = User.objects.create(email=validated_data['email'])
user.set_password(validated_data['password'])
user.save()
 return user


my view
class RegistrationView(APIView):

 def post(self, request, format='json'):
 serializer = UserSerializer(data=request.data)
 if the serializer.is_valid():
 user = serializer.save()
 if user:
 token = Token.objects.create(user=user)
 json = serializer.data
 json['token'] = token.key
 return Response(json, status=status.HTTP_201_CREATED)

 return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)


But svagger still no fields to edit
5afd40ebb41aa685757343.png
Tell me what's wrong
June 5th 19 at 21:25
1 answer
June 5th 19 at 21:27
Solution
the view should be nasledovat class GenericAPIView

Find more questions by tags DjangoRESTful API