Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. @app.route('/', methods=['POST', 'GET'])
  2. def reports():
  3. form = ReportConfig()
  4.  
  5. location = Cdr.query.with_entities(Cdr.src).distinct().limit(9).all()
  6.  
  7. call_dict = {}
  8. numberofcalls = 0
  9.  
  10. for x in location:
  11. total_calls = Cdr.query.filter_by(src=x.src).all()
  12. for y in total_calls:
  13. numberofcalls+=1
  14. call_dict[x.src] = numberofcalls
  15. print('The number of calls for ' + x.src, ':', numberofcalls)
  16. print(call_dict)
  17.  
  18. return render_template('reports.html', title='Home', form=form, location=locations_, numofcalls= call_dict)
  19.  
  20. <div class='col-4'>
  21. <div>
  22. <!-- I need the total number of calls here -->
  23. {% for num in numofcalls%}
  24. <p>{{numofcalls[num]}}</p>
  25. {% endfor %}
  26. </div>
  27.  
  28. <div>
  29. <p>Test</p>
  30. </div>
  31.  
  32. <div>
  33. <p>Test</p>
  34. </div>
  35.  
  36. <div>
  37. <p>Average</p>
  38. </div>
  39.  
  40. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement