Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Joost Rijneveld
concrexit
Commits
d31edc44
Commit
d31edc44
authored
Oct 21, 2016
by
Sébastiaan Versteeg
Browse files
Fix translation.py error when saving
parent
2cee5f74
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/utils/translation.py
View file @
d31edc44
...
...
@@ -50,10 +50,10 @@ class MultilingualField(object):
self
.
kwargs
=
kwargs
def
_i18n_attr_accessor
(
attr
):
def
_i18n_attr_accessor
(
attr
,
lang
):
def
accessor
(
self
):
return
getattr
(
self
,
I18N_FIELD_FORMAT
.
format
(
attr
,
get_language
()
))
return
getattr
(
self
,
I18N_FIELD_FORMAT
.
format
(
attr
,
lang
))
return
accessor
...
...
@@ -95,7 +95,7 @@ class ModelTranslateMeta(models.base.ModelBase):
"by TranslateMeta."
.
format
(
attr_i18n
))
dct
[
attr_i18n
]
=
field
.
cls
(
*
field
.
args
,
**
field
.
kwargs
)
fields
.
append
(
attr_i18n
)
dct
[
attr
]
=
property
(
_i18n_attr_accessor
(
attr
))
dct
[
attr
]
=
property
(
_i18n_attr_accessor
(
attr
,
get_language
()
))
default
=
I18N_FIELD_FORMAT
.
format
(
attr
,
settings
.
LANGUAGE_CODE
)
if
default
not
in
dct
:
raise
ImproperlyConfigured
(
"LANGUAGE_CODE not in LANGUAGES."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment