Skip to content

Instantly share code, notes, and snippets.

View bikeath1337's full-sized avatar

Bobby Wallace bikeath1337

View GitHub Profile
@bikeath1337
bikeath1337 / nice_key_sample
Created April 16, 2014 13:50
Generate a nice_key with dborutils.key_service
from dborutils.mongo_client import NoodleMongoClient
from dborutils.key_service import NoodleKeyService
# Requires dborutils v0.2.2
collection_spec = "localhost:graduate:production"
namespace_client = NoodleMongoClient.create_from_mongo_spec(collection_spec)
# this returns the production collection from your client spec.
collection = namespace_client.collection()
@bikeath1337
bikeath1337 / gist:10887747
Created April 16, 2014 14:47
Tutor count Per Organization
from dbor_schemas.models import NoodleTutoringOrganization
from django.db.models import Count
to = NoodleTutoringOrganization.objects.annotate(Count('primary_profile'))
for tutor_org in to:
print tutor_org.name, "tutors", tutor_org.primary_profile__count