Add management command to populate languages

This commit is contained in:
Michal Čihař 2012-02-27 10:28:33 +01:00
parent f67437c27d
commit 0b2caafbde
3 changed files with 15 additions and 0 deletions

View File

View File

View File

@ -0,0 +1,15 @@
from django.core.management.base import BaseCommand, CommandError
from lang.models import Language
from translate.lang import data
class Command(BaseCommand):
help = 'Populates language definitions'
def handle(self, *args, **options):
for code, props in data.languages.items():
lang, created = Language.objects.get_or_create(
code = code,
name = props[0],
nplurals = props[1],
pluralequation = props[2])