title: How to include a function call in a Django template?
body: <p>I have a function in my Django app (1.7) and I want to include the results from this function in a template. My function is in a utils.py file that is in the same folder with models.py, views.py, and urls.py. </p>
  
  <p>The code for my function in utils.py is:</p>
  
  <pre><code>class Defin():
      global infotree_graph
      graph = neo4j.GraphDatabaseService("http://&lt;your_url&gt;:7474/db/data/")
  
      def fetch_overview(self):
          overview_query = "&lt;query&gt;"  
          results = neo4j.CypherQuery(graph, bacm_overview_query).execute()        
  
          for r in results:        
              definition = r['definition']
  
          return definition
  </code></pre>
  
  <p>When I run this function on its own in python, I get the correct string. </p>
  
  <p>Here is my view:</p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponse
  from django.template import RequestContext, loader
  from myapp import utils
  
  def introduction(request):
      return render(request, 'myapp/introduction.html')
  
  def bacm(request):
      return render(request, 'myapp/definition.html')
  </code></pre>
  
  <p>And in my template I am including:</p>
  
  <pre><code>{{ utils.Defin.fetch_overview }}
  </code></pre>
  
  <p>And I get nothing on the screen. Is this a reasonable approach? Is there a better way to include the results from a function in a template? </p>