Commit c8df8f6e by Fábián János

In ChoiceField was changed initial tag to choices, where parameter is a list.

repaired: language chooser, tcp/udp chooser
parent 2a30103b
...@@ -46,8 +46,8 @@ from django.forms.widgets import TextInput, HiddenInput ...@@ -46,8 +46,8 @@ from django.forms.widgets import TextInput, HiddenInput
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils.html import escape, format_html from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy from django.utils.text import format_lazy
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from simplesshkey.models import UserKey from simplesshkey.models import UserKey
from sizefield.widgets import FileSizeWidget from sizefield.widgets import FileSizeWidget
...@@ -62,7 +62,7 @@ from vm.models import ( ...@@ -62,7 +62,7 @@ from vm.models import (
from .models import Profile, GroupProfile, Message from .models import Profile, GroupProfile, Message
from .validators import domain_validator, meta_data_validator, user_data_validator from .validators import domain_validator, meta_data_validator, user_data_validator
LANGUAGES_WITH_CODE = ((l[0], ugettext_lazy(l[1], " (", l[0], ")")) LANGUAGES_WITH_CODE = ((l[0], format_lazy("{} ({})",l[1], l[0]))
for l in LANGUAGES) for l in LANGUAGES)
priority_choices = ( priority_choices = (
...@@ -1103,7 +1103,7 @@ class VmPortRemoveForm(OperationForm): ...@@ -1103,7 +1103,7 @@ class VmPortRemoveForm(OperationForm):
class VmPortAddForm(OperationForm): class VmPortAddForm(OperationForm):
port = forms.IntegerField(required=True, label=_('Port'), port = forms.IntegerField(required=True, label=_('Port'),
min_value=1, max_value=65535) min_value=1, max_value=65535)
proto = forms.ChoiceField(initial=(('tcp', 'tcp'), ('udp', 'udp')), proto = forms.ChoiceField(choices=(('tcp', 'tcp'), ('udp', 'udp')),
required=True, label=_('Protocol')) required=True, label=_('Protocol'))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
...@@ -1303,7 +1303,7 @@ class TraitForm(forms.ModelForm): ...@@ -1303,7 +1303,7 @@ class TraitForm(forms.ModelForm):
class MyProfileForm(forms.ModelForm): class MyProfileForm(forms.ModelForm):
preferred_language = forms.ChoiceField( preferred_language = forms.ChoiceField(
initial=LANGUAGES_WITH_CODE, choices=LANGUAGES_WITH_CODE,
label=_("Preferred language"), label=_("Preferred language"),
) )
......
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 sign in to comment