Commit 2ad8db92 authored by Michal Čihař's avatar Michal Čihař

List only used languages in preferences. (issue #86)

parent 0e41e302
......@@ -20,6 +20,7 @@ Relased on ? 2012.
* Better layout of main page.
* Support for automatically pushing changes on every commit.
* Support for email notifications of translators.
* List only used languages in preferences.
weblate 1.1
-----------
......
......@@ -2,6 +2,7 @@ from django import forms
from django.utils.translation import ugettext_lazy as _
from weblate.accounts.models import Profile
from weblate.lang.models import Language
from django.contrib.auth.models import User
from registration.forms import RegistrationFormUniqueEmail
......@@ -14,6 +15,13 @@ class ProfileForm(forms.ModelForm):
'secondary_languages',
)
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()
self.fields['languages'].queryset = qs
self.fields['secondary_languages'].queryset = qs
class SubscriptionForm(forms.ModelForm):
class Meta:
model = Profile
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment