Created
February 4, 2011 01:38
-
-
Save FernandoEscher/810594 to your computer and use it in GitHub Desktop.
Conteo de mensajes por cada usuario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User | |
from django.db.models import Count | |
ul = User.objects.annotate(Count('_message_set')) | |
for u in ul: | |
print '%s: %s'%(u.username, u._message_set__count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment