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
6dc5246e
Commit
6dc5246e
authored
Aug 01, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out filtering for languages with translation
parent
a6f38f9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
weblate/accounts/forms.py
weblate/accounts/forms.py
+1
-1
weblate/lang/models.py
weblate/lang/models.py
+6
-0
No files found.
weblate/accounts/forms.py
View file @
6dc5246e
...
...
@@ -18,7 +18,7 @@ class ProfileForm(forms.ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
ProfileForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
# Limit languages to ones which have translation
qs
=
Language
.
objects
.
filter
(
translation__total__gt
=
0
).
distinct
()
qs
=
Language
.
objects
.
have_translation
()
self
.
fields
[
'languages'
].
queryset
=
qs
self
.
fields
[
'secondary_languages'
].
queryset
=
qs
...
...
weblate/lang/models.py
View file @
6dc5246e
...
...
@@ -270,6 +270,12 @@ class LanguageManager(models.Manager):
lang
.
pluralequation
=
props
[
3
]
lang
.
save
()
def
have_translation
(
self
):
'''
Returns list of languages which have at least one translation.
'''
return
self
.
filter
(
translation__total__gt
=
0
).
distinct
()
def
setup_lang
(
sender
=
None
,
**
kwargs
):
'''
...
...
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