Пример #1
0
class HelpForm(BootstrapForm):
    admin_class = forms.CharField(
        max_length=50,
        required=True,
        widget=forms.widgets.Select(
            choices=append_empty_choice(available_admin_classes)),
        label="Who to Contact")
    issue = forms.CharField(max_length=50,
                            required=True,
                            widget=forms.widgets.Select(
                                choices=append_empty_choice(available_issues)))
    subject = forms.CharField(max_length=255, required=True)
    message = forms.CharField(widget=forms.Textarea,
                              label="Description",
                              required=True)

    def __init__(self, *args, **kwargs):
        super(HelpForm, self).__init__(*args, **kwargs)
        self.helper.form_action = reverse(contact_form)
        self.helper.layout = Layout(
            'admin_class', 'issue', 'subject', 'message',
            FormActions(
                StrictButton(
                    '<span class="glyphicon glyphicon-remove"></span> Cancel',
                    css_class='btn-default backbutton'),
                StrictButton(
                    '<span class="glyphicon glyphicon-send"></span> Send e-mail',
                    css_class='btn-primary',
                    type="submit"),
                css_class="col-sm-offset-4"))
Пример #2
0
 def __init__(self, api, *args, **kwargs):
     super(NetworkInstanceForm, self).__init__(*args, **kwargs)
     self.fields["network"].widget = forms.widgets.Select(
         choices=append_empty_choice(external_network_list(api)))
     self.fields["host"].widget = forms.widgets.Select(
         choices=append_empty_choice(host_list(api)))
     self.helper.form_action = reverse(add)
     self.helper.layout = Layout('host', 'bridge', 'network',
                                 Buttons.cancel_add)
Пример #3
0
	def __init__(self, api, *args, **kwargs):
		super(NetworkInstanceForm, self).__init__(*args, **kwargs)
		self.fields["network"].widget = forms.widgets.Select(choices=append_empty_choice(external_network_list(api)))
		self.fields["host"].widget = forms.widgets.Select(choices=append_empty_choice(host_list(api)))
		self.helper.form_action = reverse(add)
		self.helper.layout = Layout(
			'host',
			'bridge',
			'network',
			Buttons.cancel_add
		)
Пример #4
0
def techs_choices():
    tlist = [(t["name"], t["label"]) for t in techs]
    return append_empty_choice(tlist)
Пример #5
0
def techs_choices():
    te = [('TAR', 'tar.gz'), ('RAR', 'rar'), ('ZIP', 'zip')]
    return append_empty_choice(te)
Пример #6
0
	def __init__(self, api, *args, **kwargs):
		super(AccountForm, self).__init__(*args, **kwargs)
		self.fields["organization"].widget = forms.widgets.Select(choices=append_empty_choice(organization_name_list(api)))
Пример #7
0
def techs_choices():
	tlist = [(t["name"], t["label"]) for t in techs]
	return append_empty_choice(tlist)
Пример #8
0
	def __init__(self, api, *args, **kwargs):
		super(AccountForm, self).__init__(*args, **kwargs)
		self.fields["organization"].widget = forms.widgets.Select(choices=append_empty_choice(organization_name_list(api)))