X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/891b9e3b7ecaedc9ac32bc941400a267c77482a0..70dd8cb8ca032fbf50592ff391afb3dffd1d2970:/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():