mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-04-10 16:40:57 +00:00
Show None checkboxes on form fields, especially admin (close #187).
This commit is contained in:
parent
ca11558bd9
commit
656dca3e40
2 changed files with 2 additions and 2 deletions
|
|
@ -57,7 +57,7 @@ class TranslationBaseModelAdmin(BaseModelAdmin):
|
|||
else:
|
||||
orig_formfield = self.formfield_for_dbfield(orig_field, **kwargs)
|
||||
field.widget = deepcopy(orig_formfield.widget)
|
||||
if orig_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
|
||||
if db_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
|
||||
field.widget = ClearableWidgetWrapper(field.widget)
|
||||
css_classes = field.widget.attrs.get('class', '').split(' ')
|
||||
css_classes.append('mt')
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class TranslationField(object):
|
|||
values to be preserved rather than saved as empty strings.
|
||||
"""
|
||||
formfield = super(TranslationField, self).formfield(*args, **kwargs)
|
||||
if self.translated_field.null:
|
||||
if self.null:
|
||||
if isinstance(formfield, forms.CharField):
|
||||
from modeltranslation.forms import NullableField
|
||||
form_class = formfield.__class__
|
||||
|
|
|
|||
Loading…
Reference in a new issue