def __init__(self, *args, **kwargs): super(AddSecurityForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout('name', 'label', 'subtype', 'description', 'tech', 'icon', 'creation_date', 'available_template', 'urls', Buttons.cancel_add)
def __init__(self, name, *args, **kwargs): self.formaction_targetvalue = name self.redirect_after_targetvalue = name super(ConfirmForm, self).__init__(*args, **kwargs) self.helper.layout = Layout(self.buttons) self.message = self.message % {'name': name} self.title = self.title % {'name': name}
def __init__(self, api, data): AccountForm.__init__(self, api, data) flags = api.account_flags().items() self.fields["name"].widget = FixedText() del self.fields["origin"] del self.fields["_reason"] self.fields["flags"].choices = flags if api.user.isAdmin(data["organization"]): self.fields["flags"].widget = AccountFlagCheckboxList(api) else: self.fields["flags"].widget = AccountFlagFixedList(api) is_self = data['name'] == api.account_info()['name'] if is_self: self.fields['organization'].widget = FixedText() self.helper.form_action = reverse(edit, kwargs={'id':data['name']}) self.helper.layout = Layout(*( ( 'name', 'password', 'password2', 'organization', 'realname', 'email', 'flags' ) + (() if is_self else ( 'send_mail', )) + ( Buttons.cancel_save, ) ))
def __init__(self, res_id, *args, **kwargs): super(ChangeTemplateTorrentForm, self).__init__(*args, **kwargs) self.fields['creation_date'].initial = datetime.date.today() self.helper.form_action = reverse(edit_torrent, kwargs={"res_id": res_id}) self.helper.layout = Layout('res_id', 'creation_date', 'torrentfile', Buttons.cancel_save)
def __init__(self, api, *args, **kwargs): super(ErrorDumpForm, self).__init__(*args, **kwargs) self.helper.layout = Layout( 'source', 'dump_id', self.buttons )
def __init__(self, res_id, *args, **kwargs): super(EditSecuritySoftwareForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(edit, kwargs={"res_id": res_id}) self.helper.layout = Layout('res_id', 'name', 'type', 'system', 'url', 'description', 'creation_date', Buttons.cancel_save) self.fields['res_id'].initial = res_id self.fields['res_id'].widget.attrs['readonly'] = 'True'
def __init__(self, orga_namelist, *args, **kwargs): super(SiteForm, self).__init__(*args, **kwargs) self.fields["organization"].widget = forms.widgets.Select( choices=orga_namelist) self.helper.layout = Layout('name', 'label', 'description', 'organization', 'location', 'geolocation_longitude', 'geolocation_latitude', self.buttons)
def __init__(self, *args, **kwargs): super(AddTemplateForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout('name', 'label', 'subtype', 'description', 'tech', 'preference', 'show_as_common', 'restricted', 'nlXTP_installed', 'kblang', 'icon', 'creation_date', 'torrentfile', Buttons.cancel_add)
def __init__(self, res_id, showKblang=False, *args, **kwargs): super(EditTemplateForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(edit, kwargs={"res_id": res_id}) if showKblang: self.helper.layout = Layout('res_id', 'label', 'subtype', 'description', 'preference', 'show_as_common', 'restricted', 'nlXTP_installed', 'icon', 'creation_date', 'kblang', Buttons.cancel_save) else: del self.fields['kblang'] self.helper.layout = Layout('res_id', 'label', 'subtype', 'description', 'preference', 'show_as_common', 'restricted', 'nlXTP_installed', 'icon', 'creation_date', Buttons.cancel_save)
def __init__(self, res_id, *args, **kwargs): super(EditNetworkForm, self).__init__(*args, **kwargs) self.fields["kind"].widget = forms.TextInput( attrs={'readonly': 'readonly'}) self.fields["kind"].help_text = None self.helper.form_action = reverse(edit, kwargs={"res_id": res_id}) self.helper.layout = Layout('res_id', 'kind', 'label', 'preference', 'show_as_common', 'big_icon', 'description', Buttons.cancel_save)
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)
def __init__(self, res_id, api, *args, **kwargs): super(EditNetworkInstanceForm, self).__init__(api, *args, **kwargs) self.helper.form_action = reverse(edit, kwargs={"res_id": res_id}) self.helper.layout = Layout( 'res_id', 'host', 'bridge', 'network', Buttons.cancel_save )
def __init__(self, id_, *args, **kwargs): super(EditScenarioForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(edit, kwargs={"id_": id_}) self.helper.layout = Layout('id_', 'name', 'description', 'accessibility', 'author', 'create_time', 'topology_info_json', Buttons.cancel_save) self.fields['create_time'].initial = datetime.datetime.now() self.fields['id_'].widget.attrs['readonly'] = True self.fields['author'].widget.attrs['readonly'] = True self.fields['create_time'].widget.attrs[ 'readonly'] = True # TODO: datetime is not serializable
def __init__(self, *args, **kwargs): super(NetworkForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout( 'kind', 'label', 'preference', 'show_as_common', 'big_icon', 'description', Buttons.cancel_add )
def __init__(self, site_namelist, *args, **kwargs): super(HostForm, self).__init__(*args, **kwargs) self.fields["site"].widget = forms.widgets.Select(choices=site_namelist) self.helper.layout = Layout( 'name', 'address', 'rpcurl', 'site', 'enabled', 'description_text', self.buttons )
def __init__(self, api, data=None): AccountForm.__init__(self, api, data) self.fields["password"].required = True del self.fields["flags"] del self.fields["origin"] del self.fields["aup"] del self.fields["password"] del self.fields["password2"] del self.fields["send_mail"] self.helper.form_action = reverse(register) self.helper.layout = Layout('name', 'organization', 'realname', 'email', Buttons.cancel_save)
def __init__(self, *args, **kwargs): super(AddVulnerabilityForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout( 'name', 'type', 'system', 'url', 'description', 'creation_date', Buttons.cancel_add )
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") ) )
def __init__(self, api, data=None): AccountForm.__init__(self, api, data) self.fields["password"].required = True del self.fields["flags"] del self.fields["origin"] del self.fields["send_mail"] self.fields['aup'].label = 'I accept the <a href="' + serverInfo( )['external_urls'][ 'aup'] + '" target="_blank">acceptable use policy</a>' self.helper.form_action = reverse(register) self.helper.layout = Layout('name', 'password', 'password2', 'organization', 'realname', 'email', '_reason', 'aup', Buttons.cancel_save)
def __init__(self, res_id, *args, **kwargs): super(EditRePyForm, self).__init__(res_id, *args, **kwargs) self.helper.layout = Layout( 'res_id', 'tech', 'label', 'cpus', 'ram', 'restricted', 'preference', 'description', Buttons.cancel_save )
def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_class = 'form-horizontal' self.helper.form_action = reverse(login) self.helper.form_method = "post" self.helper.label_class = 'col-lg-2 col-md-2 col-sm-2' self.helper.field_class = 'col-lg-4 col-md-5 col-sm-6' self.helper.layout = Layout( 'username', 'password', 'long_session', FormActions( StrictButton('Log in', css_class='col-sm-offset-2 btn-primary', type="submit")))
def __init__(self, *args, **kwargs): super(AddProfileForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout( 'tech', 'name', 'label', 'diskspace', 'cpus', 'ram', 'restricted', 'preference', 'description', Buttons.cancel_add )
def __init__(self, username, *args, **kwargs): super(AddScenarioForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(add) self.helper.layout = Layout( 'name', 'description', 'accessibility', 'author', # 'create_time', 'topology_info_json', Buttons.cancel_add, ) self.fields['create_time'].initial = datetime.datetime.now() self.fields['create_time'].widget.attrs['readonly'] = 'True' self.fields['author'].initial = username self.fields['author'].widget.attrs['readonly'] = 'True'
def __init__(self, *args, **kwargs): super(SysConfigForm, self).__init__(*args, **kwargs) def get_language_display_name(code, desc): try: desc = translation.get_language_info(code)['name_local'] except KeyError: # If a language is not defined in django.conf.locale.LANG_INFO # get_language_info raises KeyError pass return "%s (%s)" % (desc, code) languages = [(k, get_language_display_name(k, v)) for k, v in settings.LANGUAGES] self.fields['language'].choices = languages self.helper.form_action = reverse(config) self.helper.layout = Layout('language', Buttons.cancel_save)
def __init__(self, *args, **kwargs): super(AnnouncementForm, self).__init__(*args, **kwargs) self.helper.form_action = reverse(announcement_form) ref_conf = [(k, entity_to_label(k)) for k in reference_config().iterkeys()] ref_conf.insert(0, ("", "--No Reference--")) self.fields['ref_type'].widget = forms.widgets.Select(choices=ref_conf) self.helper.layout = Layout( 'title', 'message', 'show_sender', 'ref_type', 'ref_id', FormActions( StrictButton('<span class="glyphicon glyphicon-remove"></span> Cancel', css_class='btn-default backbutton'), StrictButton('<span class="glyphicon glyphicon-send"></span> Publish', css_class='btn-primary', type="submit"), css_class="col-sm-offset-4" ) )
def __init__(self, api, *args, **kwargs): super(ErrorGroupForm, self).__init__(*args, **kwargs) self.helper.layout = Layout('description', self.buttons)
def build(cls, action, buttons=Buttons.cancel_continue): obj = cls() obj.helper.form_action = action obj.helper.layout = Layout(buttons) return obj
def __init__(self, *args, **kwargs): super(ImportTopologyForm, self).__init__(*args, **kwargs) self.helper.layout = Layout('topologyfile', Buttons.default(label="Import"))
def __init__(self, name, *args, **kwargs): super(ConfirmForm, self).__init__(*args, **kwargs) self.helper.layout = Layout(self.buttons) self.message = self.message % {'name': name} self.title = self.title % {'name': name}
def __init__(self, *args, **kwargs): super(OrganizationForm, self).__init__(*args, **kwargs) self.helper.layout = Layout('name', 'label', 'homepage_url', 'image_url', 'description', self.buttons)