Commit fffdc741 by John Jarvis

variable cleanup, fix stdout problem and simplejson

parent 4afe11f3
import sys from django.utils.simplejson import dumps
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from certificates.models import GeneratedCertificate from certificates.models import GeneratedCertificate
import simplejson
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
l = GeneratedCertificate.objects.filter( download_url = None ).values() users = GeneratedCertificate.objects.filter(
sl = [{'user_id':x['user_id'], 'name':x['name']} for x in l] download_url = None ).values()
sys.stdout.write(simplejson.dumps(sl) + "\n") user_output = [{'user_id':user['user_id'], 'name':user['name']}
for user in users]
self.stdout.write(dumps(user_output) + "\n")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment