Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def post(self, request, format=None):
- serializer = ContactUsSerializer(data=request.data)
- if serializer.is_valid():
- serializer.save()
- return Response(serializer.data, status=HTTP_201_CREATED)
- return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)
- class ContactUsSerializer(serializers.ModelSerializer):
- def validate_logged_in_user(self, data):
- """
- Check that the start is before the stop.
- """
- # Get authenticated user for raise hit limit validation
- return self.context['request'].user
- class Meta:
- model = ContactUsQuery
- fields = ('company', 'email', 'phone', 'message','vehicle','category','logged_in_user')
Add Comment
Please, Sign In to add comment