title: How do I accept the friend request in django after sending a hyperlink in mail which redirects the user to accept/reject page?
body: <p>models.py :</p>
  
  <pre><code>class Friend(models.Model, LoginRequiredMixin):
          status = models.CharField(max_length=10)
          from_user = models.ForeignKey(AUTH_USER_MODEL, on_delete=models.CASCADE, related_name = 'from_user')
          to_user = models.ForeignKey(AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="to_user")
          date_modified = models.DateTimeField(auto_now=True, blank=True)
          date_created = models.DateTimeField(auto_now_add=True, null=True)
  
          def create(self,request, **kwargs):
              friend = self.create(from_user_id=request.user.id, status="pending")
              return friend
  </code></pre>
  
  <p>views.py :
  This view contains 2 buttons: Accept and reject and based on user response it will be updated in the database</p>
  
  <pre><code> def accept_friend_request(request, uidb64, status):
       """Accept button will lead to entry in database as accepted and reject button will lead to entry in database as rejected  based on status flag"""
      try:
          uid = urlsafe_base64_decode(uidb64).decode()
          friend_user = User.objects.get(id=Friend.to_user.id) &amp; Friend.from_user
          print(friend_user)
          f = Friend.objects.filter(friend_id = friend_user)
          print(f)
          if f:
             f.status = "accepted"
             f.save()
             return render(request, 'users/friend_list.html', {"uidb64": uid, "status": status})
          else:
             f.status = "rejected"
             f.save()
             return render(request, 'users/friend_list.html', {'uidb64':uid, 'status':status})
      except(FieldError, AttributeError):
          return render(request, 'blog/base.html')
  </code></pre>
  
  <p>Database is not  being updated on click of accept/reject</p>
  
  <p>Thanking you in advance,</p>