title: How can I repeatedly call a function from a views.py in Django?
body: <p>How can I repeatedly call a function from a views.py in Django?</p>
  
  <p>urls.py</p>
  
  <pre><code>urlpatterns = [
      url(r'^$', views.index),
      url(r'^report/(?P&lt;extension&gt;\d+)/$', views.report),
  ]
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def report(request, extension):
  
      """
          I will do some logic here. I need the extension variable for 
          database purposes.
        EX: 
          my_array = Report.objects.fetching_reports(extension='3')
      """
  
      return render(request, 'report.html’)
  </code></pre>
  
  <p>If you notice in extension, I passed in 3. The idea is that each extension will have their own data. However, I want them to render on the same html template. I will begin rendering from extension 1, up to 12 then goes back to 1. Let’s say extension 4 is missing, it will be redirected to extension 5.These extension will come from my database.</p>
  
  <pre><code>Example:
  
  …/report/1/
  …/report/2/
  …/report/3/    ## will skip 4 if not available 
  …/report/5/
  …/report/6/    ## and so on..
  </code></pre>
  
  <p>Each extension will render the same HMTL template. Right now, I can successfully render these reports if I type the URL patter directly to the browser. Is there a way to call report( ) continuously, let’s say every 15 seconds? Or should I have a different approach to this?</p>
  
  <p>Thank you very much for reading. </p>