title: Post Request Django REST Framework
body: <p>This is my views.py</p>
  
  <pre><code>from rest_framework import generics, permissions
  from .models import Survey,Response
  from .serialize import SurveySerializer,ResponseSerializer,SurveySerializerQuestion
  from rest_framework.decorators import api_view
  
  class SurveyList(generics.ListAPIView):
      model = Survey
      serializer_class = SurveySerializerQuestion
  
      def get_queryset(self):
  
          return Survey.objects.all()
  
  
  class SurveyListByID(generics.ListAPIView):
      model = Survey
      serializer_class = SurveySerializer
  
      def get_queryset(self):
          survey_id = self.kwargs['survey_id']
          return Survey.objects.filter(survey_id = survey_id)
  
  
  class ResponseList(generics.ListAPIView):
  
      model = Response
      serializer_class = ResponseSerializer
  
      def get_queryset(self):
          survey_id = self.kwargs['survey_id']
          return Response.objects.filter(survey_id = survey_id)
  </code></pre>
  
  <p>This is my urls.py</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from views import SurveyList,SurveyListByID,ResponseList
  urlpatterns = patterns('',
  url(r'^surveys/$', SurveyList.as_view(),name ='survey-list') ,
  url(r'^surveys/(?P&lt;survey_id&gt;[0-9]+)/$', SurveyListByID.as_view(),name ='survey-list-by-id'), 
  url(r'^response/(?P&lt;survey_id&gt;[0-9]+)/$', ResponseList.as_view(),name ='response-list'), 
  )
  </code></pre>
  
  <p>This is serialize.py</p>
  
  <pre><code>from rest_framework import serializers
  from .models import Employee,Survey,EmployeeSurvey,Response
  
  class SurveySerializer(serializers.ModelSerializer):
  
      class Meta:
          model = Survey
          fields = ('survey_id', 'question', 'choice1','choice2')
  
  
  class SurveySerializerQuestion(serializers.ModelSerializer):
  
      class Meta:
          model = Survey
          fields = ('survey_id', 'question')
  
  class ResponseSerializer(serializers.ModelSerializer):
      class Meta:
          model = Response
          fields = ('id','survey_id','choice1_count','choice2_count')
  </code></pre>
  
  <p>finally this is models.py</p>
  
  <pre><code>import re
  from django.db import models
  from django.core.validators import RegexValidator
  from django.core.exceptions import ValidationError
  
  def alphanumeric_test(val):
      if not re.match('^[0-9a-zA-Z]*$', val):
          raise ValidationError('Only alphanumeric characters are allowed.')
  
  def alphabetic_test(val):
      if not re.match('^[a-zA-Z]*$', val):
          raise ValidationError('Please enter alphabetic value.')
  
  class Survey(models.Model):
      survey_id = models.AutoField(primary_key=True)
      question = models.CharField(max_length = 300)
      choice1 = models.CharField(max_length = 100)
      choice2 = models.CharField(max_length = 100)
      def __unicode__(self):              
          return u'%s %s %s' % (self.question,self.choice1,self.choice2)
  
  
  class Response(models.Model):
          survey_id = models.ForeignKey(Survey, blank=True, null=True, on_delete=models.SET_NULL)
          choice1_count = models.IntegerField()
          choice2_count = models.IntegerField()
          def __unicode__(self):              
      return u'%s %s %s' % (self.survey_id,self.choice1_count,self.choice2_count)
  </code></pre>
  
  <p>Now how do I write a POST request in Django Rest without UI and using the Django Rest Browser.
  I want to do a POST request to capture the choice in the survey using a url like I did for get.Is that possible?</p>