Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. try:
  2. tweet = twitter.Api(username='mgit_toms', password='t0mst0mst0ms')
  3. statuses = tweet.GetUserTimeline('mgit_toms')
  4. except Exception:
  5. twit = 0
  6.  
  7. linux_total = device.objects.filter(groups__in = [1]).count()
  8. win_total = device.objects.filter(groups__in = [2]).count()
  9. han_total = device.objects.filter(location = 2).count()
  10. ric_total = device.objects.filter(location = 1).count()
  11. bdot_total = device.objects.filter(location = 4).count()
  12. dt_total = device.objects.filter(location = 3).count()
  13. rack_total = device.objects.filter(location = 5).count()
  14. rackdr_total = device.objects.filter(location = 5).count()
  15. fcg_total = device.objects.filter(location = 8).count()
  16.  
  17. if twit:
  18. return render_to_response('index.html', { 'loc_list': loc_list, 'statuses': statuses[:5], 'linux_total': linux_total, 'win_total': win_total, 'han_total': han_total, 'ric_total': ric_total, 'bdot_total': bdot_total, 'dt_total': dt_total, 'rack_total': rack_total, 'rackdr_total': rackdr_total, 'fcg_total': fcg_total }, context_instance=RequestContext(request))
  19. else:
  20. return render_to_response('index.html', { 'loc_list': loc_list, 'linux_total': linux_total, 'win_total': win_total, 'han_total': han_total, 'ric_total': ric_total, 'bdot_total': bdot_total, 'dt_total': dt_total, 'rack_total': rack_total, 'rackdr_total': rackdr_total, 'fcg_total': fcg_total }, context_instance=RequestContext(request))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement