Blame view

dictionary/management/commands/approve_examples.py 473 Bytes
Bartłomiej Nitoń authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#-*- 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