X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/67df302167539474edd02b57c2e8bd30349d7625..a728fedba796dcf8d969c6f96def0f630d05f2f9:/apps/modeltranslation/management/commands/update_translation_fields.py diff --git a/apps/modeltranslation/management/commands/update_translation_fields.py b/apps/modeltranslation/management/commands/update_translation_fields.py index adb5e6de9..78cd74298 100644 --- a/apps/modeltranslation/management/commands/update_translation_fields.py +++ b/apps/modeltranslation/management/commands/update_translation_fields.py @@ -2,6 +2,7 @@ from django.conf import settings from django.core.management.base import (BaseCommand, CommandError, NoArgsCommand) +from optparse import make_option from modeltranslation.translator import translator from modeltranslation.utils import build_localized_fieldname @@ -11,8 +12,15 @@ class Command(NoArgsCommand): help = 'Updates the default translation fields of all or the specified' \ 'translated application using the value of the original field.' + option_list = BaseCommand.option_list + ( + make_option('-d', '--default', action='store', dest='default', default=None), ) + + def handle(self, **options): - default_lang = settings.LANGUAGES[0][0] + if options['default']: + default_lang = options['default'] + else: + default_lang = settings.LANGUAGES[0][0] print "Using default language:", default_lang for model, trans_opts in translator._registry.items():