title: Django - Calling one class method from another in Class Based View
body: <p>I have a method inside a django class based view like called <code>get_player_stats</code>. From this method I want to call another method in the same class but I am unable to. Code is like below:</p>
  
  <pre><code>class ScoreView(TemplateView):
  
     def get_player_stats(request):
         player_id = request.GET.get(player_id, None)
         # compute  player stats
  
         #here I want to call like below:
         self.get_team_stats(player_id)
  
     def get_team_stats(self, player_id):
        #compute team stats
  </code></pre>
  
  <p>When I run this it says <code>name 'self' is not defined</code></p>
  
  <p>If I try <code>def get_player_stats(self, request):</code> it says <code>missing 1 required positional argument: 'request'</code></p>
  
  <p>If I try <code>def get_player_stats(request, self):</code> it says <code>missing 1 required positional argument: 'self'</code></p>
  
  <p>How can I call <code>get_team_stats</code> from <code>get_player_stats</code>?</p>
  
  <p>This is very frustrating, any help is greatly appreciated</p>
  
  <p>P.S: I call <code>get_player_stats</code> as an ajax call by defining a URL path as below:</p>
  
  <pre><code>url('score/get_player_stats', views.ScoreView.get_player_stats)
  </code></pre>
  
  <p>Then I call it using $.ajax with <code>url: '/score/get_player_stats'</code></p>