title: Jinja2 custom function giving positional argument error
body: <p>I have a custom filter in Jinja that requires two arguments, I am calling the function inside my Jinja template and I am getting an TypeError about positional arguments. That my function takes two (correct) but that 3 were given (incorrect)</p>
  
  <p>Here is the function code</p>
  
  <pre><code># Get the total balance of a student to display for an instructor
  def get_stud_balance(inst_id, stud_id):
      balance = 0
      stud_balance = Packages.query.filter(Packages.inst_id == inst_id, Packages.stud_id == stud_id).all()
      for row in stud_balance:
          balance += row.balance
      return balance
  </code></pre>
  
  <p>This is how it is registered..</p>
  
  <pre><code>app.jinja_env.filters['get_balance'] = filters.get_stud_balance
  </code></pre>
  
  <p>This is how I am trying to call it..</p>
  
  <pre><code>{% for row in studs %} &lt;!-- START for loop --&gt;
                  &lt;div class="col-md-4"&gt;
                      &lt;div class="panel panel-default"&gt;
                          &lt;div class="panel-heading"&gt;&lt;center&gt;{{ row.first_name }} {{ row.last_name }}&lt;/center&gt;&lt;/div&gt;
                          &lt;div class="panel-body"&gt;
                              &lt;li&gt;Cell Phone: {{ row.cell|phone }}&lt;/li&gt;
                              &lt;li&gt;Home Phone: {{ row.home|phone }}&lt;/li&gt;
                              &lt;li&gt;Email: {{ row.email }} &lt;/li&gt;
                              &lt;li&gt;Birthday: {{ row.birthday|date }}&lt;/li&gt;
                              &lt;li&gt;Gender: {{ row.gender|gender }}&lt;/li&gt;
                              &lt;li&gt;Balance: {{ balance|get_balance(row.inst_id, row.stud_id) }}&lt;/li&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  {% endfor %} &lt;!-- /END for loop --&gt;
  </code></pre>
  
  <p>What am I missing here? I can run the function with no issue if I just run it from the file, but not when loading the template.</p>