title: How to Perform a Delete operation in Django rest Framework?
body: <p>Hello Iam new in Django rest framework,i want to create custom delete funtion to delete .I successfully created <strong>create</strong> and <strong>update</strong> as in my below code but i cant create delete function.But i searched lots of article about it but i havent found .Hopefully U will help me .</p>
  
  <h2>1. models.py</h2>
  
  <pre><code>   class User(AbstractUser, BaseModel):
  
  
      full_name = models.CharField(max_length=64)
  
          addresss=models.CharField(max_length=40)
  
          phoneno=models.IntegerField(null=True, blank=True)
  
          email=models.EmailField()
  
          password=models.CharField(max_length=40)
  
          re_password=models.CharField(max_length=40)
  
  
          gender=models.IntegerField(choices=gender_choice,default='0')
  
      ##models for student register
      class Student(BaseModel):
          user = models.ForeignKey(User, on_delete=models.CASCADE)
  
          father_name=models.CharField(max_length=64)
          mother_name=models.CharField(max_length=60)
          date_of_birth=models.DateField(null=True)
  
          def __str__(self):
              return self.user.full_name
  </code></pre>
  
  <h2>2. Serializer.py</h2>
  
  <pre><code>    class StudentSerializer(serializers.HyperlinkedModelSerializer):
          user = UserSerializer()
          class Meta:
              model=Student
              fields=(
                  'id',
                  'father_name',
                  'mother_name',
                  'date_of_birth',
                  'user',
                  )
  
   3. serializer.for user
  
      class UserSerializer(serializers.HyperlinkedModelSerializer):
          class Meta:
              model = User
              fields=('full_name','id','addresss','phoneno','email','password','re_password','gender')
  </code></pre>
  
  <h2>4. views.py</h2>
  
  <pre><code>    class StudentViewset(viewsets.ModelViewSet):
          queryset = Student.objects.all()
          serializer_class = StudentSerializer
  
          http_methods = ['get', 'post','put',]
  
  
          def create(self, request):
              serializer = self.get_serializer(data=request.data)
              serializer.is_valid(raise_exception=True)
  
              row = serializer.data
              user = row['user']
  
              if user['password'] != user['re_password']:
                  return Response({'message':'pw not matched'})
  
              email = username = row['user']['email']
  
              user, created = User.objects.get_or_create(email=email, 
                  defaults={'full_name':row['user']['full_name'],'addresss':row['user']['addresss'],
                  'phoneno':row['user']['phoneno'],'password':row['user']['password'] ,'re_password':row['user']['re_password'],
                  'gender':row['user']['gender'] ,'username':username})
  
              if created == False:
                  return Response({'message':'Sorry the student is already registered.'})
  
              student = Student.objects.create(user_id=user.id)
  
              return Response(row)
  
          def update(self,request,*args,**kwargs):
              instance=self.get_object()
              serializer=StudentUpdateSerializer(data=request.data)
  
              serializer.is_valid(raise_exception=True)
  
              data = serializer.data
              if data.get('father_name', False):
                  instance.father_name = data.get('father_name')
  
              if data.get('mother_name', False):
                  instance.mother_name = data.get('mother_name')
  
              instance.save()
              return Response(serializer.data)
  Q.
  def delete(..)#How to write this delete Function???
  </code></pre>