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 certificates.models import GeneratedCertificate
import simplejson
class Command(BaseCommand):
def handle(self, *args, **options):
l = GeneratedCertificate.objects.filter( download_url = None ).values()
sl = [{'user_id':x['user_id'], 'name':x['name']} for x in l]
sys.stdout.write(simplejson.dumps(sl) + "\n")
users = GeneratedCertificate.objects.filter(
download_url = None ).values()
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