X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/891b9e3b7ecaedc9ac32bc941400a267c77482a0..2b96b3e346a68d086568c8fc57c1df455105c062:/apps/modeltranslation/fields.py?ds=sidebyside diff --git a/apps/modeltranslation/fields.py b/apps/modeltranslation/fields.py index 5498d6b1d..fe413ce3e 100644 --- a/apps/modeltranslation/fields.py +++ b/apps/modeltranslation/fields.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from django.conf import settings from django.db.models.fields import Field, CharField +from django.utils.translation import string_concat from modeltranslation.utils import get_language, build_localized_fieldname @@ -44,12 +45,8 @@ class TranslationField(Field): # Copy the verbose name and append a language suffix (will e.g. in the # admin). This might be a proxy function so we have to check that here. - if hasattr(translated_field.verbose_name, '_proxy____unicode_cast'): - verbose_name = \ - translated_field.verbose_name._proxy____unicode_cast() - else: - verbose_name = translated_field.verbose_name - self.verbose_name = '%s [%s]' % (verbose_name, language) + self.verbose_name = string_concat(translated_field.verbose_name, + ' [%s]' % (language, )) def pre_save(self, model_instance, add): val = super(TranslationField, self).pre_save(model_instance, add) @@ -74,6 +71,10 @@ class TranslationField(Field): field_class = '%s.%s' % (self.translated_field.__class__.__module__, self.translated_field.__class__.__name__) args, kwargs = introspector(self.translated_field) + + # This is patched in init and so should be here! -- lqc + kwargs['blank'], kwargs['null'] = True, True + # That's our definition! return (field_class, args, kwargs)