daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def post(self, request, format=None):
  2.         serializer = ContactUsSerializer(data=request.data)
  3.         if serializer.is_valid():
  4.             serializer.save()
  5.             return Response(serializer.data, status=HTTP_201_CREATED)
  6.         return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)
  7.    
  8. class ContactUsSerializer(serializers.ModelSerializer):
  9.  
  10.     def validate_logged_in_user(self, data):
  11.         """
  12.         Check that the start is before the stop.
  13.         """
  14.         # Get authenticated user for raise hit limit validation
  15.         return self.context['request'].user
  16.  
  17.     class Meta:
  18.         model = ContactUsQuery
  19.         fields = ('company', 'email', 'phone', 'message','vehicle','category','logged_in_user')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top