approve_examples.py 473 Bytes
#-*- coding:utf-8 -*-

from django.core.management.base import BaseCommand

from dictionary.models import NKJP_Example

class Command(BaseCommand):
    args = 'none'
    help = ""

    def handle(self, **options):
        approve_examples()
        
def approve_examples():
    for example in NKJP_Example.objects.filter(approved=False):
        if example.approvers.count() > 0:
            example.approved = True
            example.save()
            print example