title: Calling a function from another file to use in templates
body: <p>I have a function to create a percentage in this file</p>
  
  <pre><code>status.py
  
  class Status:
      read_books = Books.objects.filter(read="True")
      all_books = Books.objects.all()
  
      def percentage(self):
          asdf = get_percentage(len(self.read_books),len(self.all_books))
          return asdf
  </code></pre>
  
  <p>I am trying to be able to use this function in my template to display this percentage by using something like this in my template</p>
  
  <pre><code>{{ status.percentage }}
  </code></pre>
  
  <p>Is this possible? would i have to put logic into my view in order to do this?</p>
  
  <p>perhaps i could put this function in my view class and call it from there? </p>
  
  <p>EDIT: </p>
  
  <pre><code>views.py
  
  class BooksView(TemplateView):
      template_name = 'KPI/Books.html'
      read_books = Books.objects.filter(read="True")
      all_books = Books.objects.all()
  
  
      def get_context_data(self, **kwargs):
          context = super(BooksView, self).get_context_data(**kwargs)
          context['all_books'] = self.all_books
          context['read_books'] = self.read_books    
          return context
  </code></pre>