Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
4d114980
Commit
4d114980
authored
Jan 08, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate language preferences import
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
dd80709d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
weblate/accounts/management/commands/importuserdata.py
weblate/accounts/management/commands/importuserdata.py
+15
-9
No files found.
weblate/accounts/management/commands/importuserdata.py
View file @
4d114980
...
...
@@ -46,6 +46,20 @@ class Command(BaseCommand):
for
field
in
Profile
.
SUBSCRIPTION_FIELDS
:
setattr
(
profile
,
field
,
userprofile
[
field
])
def
update_languages
(
self
,
profile
,
userprofile
):
"""
Updates user language preferences.
"""
profile
.
language
=
userprofile
[
'language'
]
for
lang
in
userprofile
[
'secondary_languages'
]:
profile
.
secondary_languages
.
add
(
Language
.
objects
.
get
(
code
=
lang
)
)
for
lang
in
userprofile
[
'languages'
]:
profile
.
languages
.
add
(
Language
.
objects
.
get
(
code
=
lang
)
)
def
handle
(
self
,
*
args
,
**
options
):
'''
Creates default set of groups and optionally updates them and moves
...
...
@@ -79,15 +93,7 @@ class Command(BaseCommand):
# Update fields if we should
if
update
:
profile
.
language
=
userprofile
[
'language'
]
for
lang
in
userprofile
[
'secondary_languages'
]:
profile
.
secondary_languages
.
add
(
Language
.
objects
.
get
(
code
=
lang
)
)
for
lang
in
userprofile
[
'languages'
]:
profile
.
languages
.
add
(
Language
.
objects
.
get
(
code
=
lang
)
)
self
.
update_languages
(
profile
,
userprofile
)
# Add subscriptions
self
.
import_subscriptions
(
profile
,
userprofile
)
...
...
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