title: Calling a function from a function
body: <p>I have some logic within a view that I want to have rendered on multiple templates.</p>
  <p>How do I call the logic view from within another view and pass the data back to the view to be rendered?</p>
  <p>This is a simple test I was doing.</p>
  <pre><code>def table_view(request):
      today = now().date()
      project_data = get_data_view
      context = {'projects_data':project_data}
      
      return render(request, &quot;pages/project_table.html&quot;, context=context)
  
  def get_data_view(request):
      project_list = Project.objects.all()
      context = {&quot;project_list&quot;:project_list}
      return {'context':context}
  
  </code></pre>
  <p>The table view just renders a table, but the data within the table I want from the <code>get_data_view</code></p>
  <p>I know I can write the logic within the same view, but some of my views contain a lot of code and don't want to be repeating the same code to retrieve the same data.</p>