Generated: Thu 2013-12-19 21:13 GMT
Source file: /var/www/service.dev/service/ftp_deploy/server/forms/service.py
Stats: 27 executed, 0 missed, 6 excluded, 45 ignored
from django import formsfrom django.core.urlresolvers import reversefrom crispy_forms.helper import FormHelperfrom crispy_forms.bootstrap import FormActionsfrom crispy_forms.layout import Layout, Fieldset, Field, Submit, Divfrom ftp_deploy.models import Serviceclass ServiceForm(forms.ModelForm): """Add/Edit service form""" def __init__(self, *args, **kwargs): super(ServiceForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_id = 'service-form' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-sm-3' self.helper.field_class = 'col-sm-9' self.helper.html5_required = True self.helper.layout = Layout( Fieldset('FTP Settings', 'ftp_host', 'ftp_username', 'ftp_password', 'ftp_path' ), Fieldset('Repository', Field('repo_source', data_action=reverse('ftpdeploy_bb_api', args=(0,))), 'repo_name', 'repo_slug_name', 'repo_branch' ), Fieldset('Notification', 'notification' ), Fieldset('Security', 'secret_key' ), Div( Div( Submit('save', 'Submit', css_class='pull-right'), css_class='col-sm-12' ), css_class='row' ) ) class Meta: model = Service exclude = ['status', 'status_date', 'status_message'] widgets = { 'ftp_password': forms.PasswordInput(render_value=True), }class ServiceNotificationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ServiceNotificationForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_id = 'notification-form' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'hide' self.helper.field_class = 'col-sm-12' self.helper.form_tag = False self.helper.layout = Layout( 'notification' ) class Meta: model = Service fields = ['notification']