title: Having a problem with the follower system, I am following myself in Django and also this error shows ValueError at /accounts/users/2/accept_follower/
body: <p>Hey guys I am trying to send a follow request through the django notifications and the person at the other end will be either accepting or rejecting the request. But I have a problem that when the person at the other end accepts the request, this error is showing</p>
  <pre><code>ValueError at /accounts/users/2/accept_follower/
  The view accounts.views.accept_follow_request didn't return an HttpResponse object. It returned None instead.
  </code></pre>
  <p>and he is following himself. I tried printing out the current_user and user in send_follow_request function and it is showing the 2 users correctly, but in the accept_follow_request function, both the users are same! How to change that?</p>
  <p>This is the code I have now.</p>
  <pre><code>def send_follow_request(request, id):
      current_user = request.user
      user = Account.objects.get(id=id)
      notify.send(request.user, recipient=user, verb='has sent you a follow request', target=user)
      return redirect('posts:userprofile', user.username)
  
  def accept_follow_request(request, id):
      current_user = request.user
      user = Account.objects.get(id=id)
      contact, created = Contact.objects.get_or_create(user_from=request.user, user_to=user, follow_status='AC')
      if user != request.user:
          create_action(request.user, 'started following', user)
          notify.send(request.user, recipient=user, verb='started following you')
          return redirect('all_user_notifications')
  </code></pre>
  <p>This is the notification view</p>
  <pre><code>class AllNotificationsList(LoginRequiredMixin, NotificationViewList):
      def get_queryset(self, *args, **kwargs):
          if get_config()['SOFT_DELETE']:
              qset = self.request.user.notifications.active()
          else:
              qset = self.request.user.notifications.all()
          return qset
  </code></pre>
  <p>Can anyone tell me where the problem is?</p>
  <p>This is the form I have in the notificaion template:</p>
  <pre><code>                {% if notice.target == user %}
                  &lt;form action=&quot;{% url 'accept_follow_request' user.id %}&quot;&gt;
                      &lt;button class=&quot;btn-sm btn-success&quot; type=&quot;submit&quot;&gt;Accept&lt;/button&gt;
                      &lt;a href=&quot;&quot; class=&quot;btn btn-sm btn-danger&quot;&gt;Cancel&lt;/a&gt;
                  &lt;/form&gt;
  </code></pre>
  <p>This is the model I have</p>
  <pre><code>class Contact(models.Model):
      user_from = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='rel_from_set', on_delete=models.CASCADE)
      user_to = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='rel_to_set', on_delete=models.CASCADE)
      created = models.DateTimeField(auto_now_add=True, db_index=True)
      follow_status = models.CharField(choices=FOLLOW_STATUS, max_length=10)
  
  
      #USER_FROM IS THE ONE WHO IS FOLLOWING AND USER_TO IS ONE BEING FOLLOWED
      class Meta:
          ordering = ('-created',)
  
      def __str__(self):
          return f'{self.user_from} follows {self.user_to}'
  
  
  following = models.ManyToManyField('self', through=Contact, related_name='followers', symmetrical=False)
  
      #adding the above field to User Model class
  user_model = get_user_model()
  user_model.add_to_class('following', models.ManyToManyField('self', through=Contact, related_name='followers',
                                  symmetrical=False))
  </code></pre>
  <p>url:</p>
  <pre><code>path('&lt;int:id&gt;/accept_follower/', views.accept_follow_request, name='accept_follow_request'),
  </code></pre>
  <p>Traceback:</p>
  <pre><code>    C:\Users\danny\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\exception.py in inner
              response = get_response(request) …
  ▼ Local vars
  Variable    Value
  exc 
  ValueError(&quot;The view accounts.views.accept_follow_request didn't return an HttpResponse object. It returned None instead.&quot;)
  get_response    
  &lt;bound method BaseHandler._get_response of &lt;django.core.handlers.wsgi.WSGIHandler object at 0x039FC6E8&gt;&gt;
  request 
  &lt;WSGIRequest: GET '/accounts/users/2/accept_follower/'&gt;
  C:\Users\danny\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py in _get_response
              raise ValueError( …
  ▼ Local vars
  Variable    Value
  callback    
  &lt;function accept_follow_request at 0x04D19E80&gt;
  callback_args   
  ()
  callback_kwargs 
  {'id': 2}
  middleware_method   
  &lt;bound method CsrfViewMiddleware.process_view of &lt;django.middleware.csrf.CsrfViewMiddleware object at 0x03A2B3D0&gt;&gt;
  request 
  &lt;WSGIRequest: GET '/accounts/users/2/accept_follower/'&gt;
  resolver    
  &lt;URLResolver 'socialwebsite.urls' (None:None) '^/'&gt;
  resolver_match  
  ResolverMatch(func=accounts.views.accept_follow_request, args=(), kwargs={'id': 2}, url_name=accept_follow_request, app_names=[], namespaces=[], route=accounts/users/&lt;int:id&gt;/accept_follower/)
  response    
  None
  self    
  &lt;django.core.handlers.wsgi.WSGIHandler object at 0x039FC6E8&gt;
  view_name   
  'accept_follow_request'
  wrapped_callback    
  &lt;function accept_follow_request at 0x04D19E80&gt;
  </code></pre>
  <p>Thanks!</p>