SHARE
TWEET

Untitled

a guest Jun 15th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from datetime import datetime, timezone
  2.     from django.core.management import BaseCommand
  3.     from django.contrib.auth.models import User
  4.     from tasks.models import TodoItem
  5.     from django.db.models import Count
  6.  
  7.      class Command(BaseCommand):
  8. help = "Count TopUsers"
  9.  
  10. def add_arguments(self, parser):
  11.     parser.add_argument("--top-rated", dest='top-users', type=int, default=25)
  12.  
  13. def handle(self, *args, **options):
  14.     for u in User.objects.all():
  15.         u.tasks.filter(is_completed=True).count():
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top