def __init__(self, *args, **kwargs): super(ServerForm, self).__init__(*args, **kwargs) for field in self.fields: self.fields[field].widget.attrs["autocomplete"] = "off" self.fields["ip_address"].widget.attrs["placeholder"] = "IP Address" self.fields["name"].widget.attrs["placeholder"] = "Hostname" self.fields["server_status"].empty_label = "-- Select Status --" self.fields["server_provider"].empty_label = "-- Select Provider --" self.fields["note"].widget.attrs["placeholder"] = "" self.helper = FormHelper() # Turn on <form> tags for this parent form self.helper.form_tag = True self.helper.form_show_labels = False self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Server Information", HTML( """ <p class="form-spacer"></p> """ ), "ip_address", "name", Row( Column("server_status", css_class="form-group col-md-6 mb-0"), Column("server_provider", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), "note", link_css_class="icon server-icon", css_id="server", ), CustomTab( "Additional Addresses", HTML( """ <p class="form-spacer"></p> """ ), Formset("addresses", object_context_name="Address"), Button( "add-address", "Add Address", css_class="btn-block btn-secondary formset-add-address", ), HTML( """ <p class="form-spacer"></p> """ ), link_css_class="icon route-icon", css_id="addresses", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML( """ <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """ ), ), )
def __init__(self, *args, **kwargs): super(FindingForm, self).__init__(*args, **kwargs) self.fields["title"].widget.attrs["placeholder"] = "SQL Injection" self.fields["title"].widget.attrs["autocomplete"] = "off" self.fields["description"].widget.attrs[ "placeholder"] = "What is this ..." self.fields["impact"].widget.attrs[ "placeholder"] = "What is the impact ..." self.fields["mitigation"].widget.attrs[ "placeholder"] = "What needs to be done ..." self.fields["replication_steps"].widget.attrs[ "placeholder"] = "How to reproduce/find this issue ..." self.fields["host_detection_techniques"].widget.attrs[ "placeholder"] = "How to detect it on an endpoint ..." self.fields["network_detection_techniques"].widget.attrs[ "placeholder"] = "How to detect it on a network ..." self.fields["references"].widget.attrs[ "placeholder"] = "Some useful links and references ..." self.fields["finding_guidance"].widget.attrs[ "placeholder"] = "When using this finding in a report be sure to include ..." # Design form layout with Crispy FormHelper self.helper = FormHelper() self.helper.form_show_labels = True self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Categorization", "title", Row( Column("finding_type", css_class="form-group col-md-6 mb-0"), Column("severity", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), link_css_class="tab-icon search-icon", css_id="general-tab", ), CustomTab( "Description", "description", "impact", link_css_class="tab-icon pencil-icon", css_id="description-tab", ), CustomTab( "Defense", "mitigation", "replication_steps", "host_detection_techniques", "network_detection_techniques", link_css_class="tab-icon shield-icon", css_id="defense-tab", ), CustomTab( "References", "references", "finding_guidance", link_css_class="tab-icon link-icon", css_id="reference-tab", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML(""" <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """), ), )
def __init__(self, *args, **kwargs): super(ProjectForm, self).__init__(*args, **kwargs) self.fields["start_date"].widget.attrs["placeholder"] = "mm/dd/yyyy" self.fields["start_date"].widget.attrs["autocomplete"] = "off" self.fields["start_date"].widget.attrs["autocomplete"] = "off" self.fields["start_date"].widget.input_type = "date" self.fields["end_date"].widget.attrs["placeholder"] = "mm/dd/yyyy" self.fields["end_date"].widget.attrs["autocomplete"] = "off" self.fields["end_date"].widget.attrs["autocomplete"] = "off" self.fields["end_date"].widget.input_type = "date" self.fields["slack_channel"].widget.attrs["placeholder"] = "#slack-channel" self.fields["note"].widget.attrs["placeholder"] = "Description of the Project" # Hide labels for specific fields because ``form_show_labels`` takes priority self.fields["start_date"].label = False self.fields["end_date"].label = False self.fields["note"].label = False self.fields["slack_channel"].label = False self.fields["project_type"].label = False self.fields["client"].label = False self.fields["codename"].label = False # Design form layout with Crispy FormHelper self.helper = FormHelper() # Turn on <form> tags for this parent form self.helper.form_tag = True self.helper.form_class = "form-inline justify-content-center" self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Project Information", HTML( """ <p class="form-spacer"></p> """ ), Row( Column( "client", ), Column( FieldWithButtons( "codename", HTML( """ <button class="btn btn-secondary js-roll-codename" roll-codename-url="{% url 'rolodex:ajax_roll_codename' %}" type="button" onclick="copyStartDate($(this).closest('div').find('input'))" > <i class="fas fa-dice"></i> </button> """ ), ), css_class="col-md-6", ), ), Row( Column("start_date", css_class="form-group col-md-6 mb-0"), Column("end_date", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), Row( Column("project_type", css_class="form-group col-md-6 mb-0"), Column("slack_channel", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), "update_checkouts", "note", link_css_class="project-icon", css_id="project", ), CustomTab( "Assignments", HTML( """ <p class="form-spacer"></p> """ ), Formset("assignments", object_context_name="Assignment"), Button( "add-assignment", "Add Assignment", css_class="btn-block btn-secondary formset-add-assign", ), HTML( """ <p class="form-spacer"></p> """ ), link_css_class="assignment-icon", css_id="assignments", ), CustomTab( "Objectives", HTML( """ <p class="form-spacer"></p> """ ), Formset("objectives", object_context_name="Objective"), Button( "add-objective", "Add Objective", css_class="btn-block btn-secondary formset-add-obj", ), HTML( """ <p class="form-spacer"></p> """ ), link_css_class="objective-icon", css_id="objectives", ), CustomTab( "Scope Lists", HTML( """ <p class="form-spacer"></p> """ ), Formset("scopes", object_context_name="Scope"), Button( "add-scope", "Add Scope List", css_class="btn-block btn-secondary formset-add-scope", ), HTML( """ <p class="form-spacer"></p> """ ), link_css_class="tab-icon list-icon", css_id="scopes", ), CustomTab( "Targets", HTML( """ <p class="form-spacer"></p> """ ), Formset("targets", object_context_name="Target"), Button( "add-target", "Add Target", css_class="btn-block btn-secondary formset-add-target", ), HTML( """ <p class="form-spacer"></p> """ ), link_css_class="tab-icon list-icon", css_id="targets", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML( """ <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """ ), ), )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["name"].widget.attrs["placeholder"] = "Full Company Name" self.fields["name"].widget.attrs["autocomplete"] = "off" self.fields["short_name"].widget.attrs[ "placeholder"] = "Short Company Name" self.fields["short_name"].widget.attrs["autocomplete"] = "off" self.fields["note"].widget.attrs[ "placeholder"] = "Brief Description of the Organization or a Note" self.fields["address"].widget.attrs[ "placeholder"] = "Company's Address for Reporting or Shipping" # Design form layout with Crispy FormHelper self.helper = FormHelper() # Turn on <form> tags for this parent form self.helper.form_tag = True self.helper.form_show_labels = False self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Client Information", HTML(""" <p class="form-spacer"></p> """), "name", Row( Column("short_name", css_class="form-group col-md-4 mb-0"), Column( FieldWithButtons( "codename", HTML(""" <button class="btn btn-secondary js-roll-codename" roll-codename-url="{% url 'rolodex:ajax_roll_codename' %}" type="button" onclick="copyStartDate($(this).closest('div').find('input'))" > <i class="fas fa-dice"></i> </button> """), ), css_class="col-md-4", ), Column("timezone", css_class="form-group col-md-4 mb-0"), ), "address", "note", link_css_class="client-icon", css_id="client", ), CustomTab( "Points of Contact", HTML(""" <p class="form-spacer"></p> """), Formset("contacts", object_context_name="Contact"), Button( "add-contact", "Add Contact", css_class="btn-block btn-secondary formset-add-poc", ), HTML(""" <p class="form-spacer"></p> """), link_css_class="poc-icon", css_id="contacts", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML(""" <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """), ), )
def __init__(self, *args, **kwargs): super(ProjectForm, self).__init__(*args, **kwargs) self.fields["start_date"].widget.attrs["placeholder"] = "mm/dd/yyyy" self.fields["start_date"].widget.attrs["autocomplete"] = "off" self.fields["start_date"].widget.attrs["autocomplete"] = "off" self.fields["start_date"].widget.input_type = "date" self.fields["end_date"].widget.attrs["placeholder"] = "mm/dd/yyyy" self.fields["end_date"].widget.attrs["autocomplete"] = "off" self.fields["end_date"].widget.attrs["autocomplete"] = "off" self.fields["end_date"].widget.input_type = "date" self.fields["slack_channel"].widget.attrs[ "placeholder"] = "#client-rt-2020" self.fields["note"].widget.attrs[ "placeholder"] = "This project is intended to assess ..." # Hide labels for specific fields because ``form_show_labels`` takes priority self.fields["start_date"].label = False self.fields["end_date"].label = False self.fields["note"].label = False self.fields["slack_channel"].label = False self.fields["project_type"].label = False self.fields["client"].label = False # Design form layout with Crispy FormHelper self.helper = FormHelper() # Turn on <form> tags for this parent form self.helper.form_tag = True self.helper.form_class = "form-inline justify-content-center" self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Project Information", HTML(""" <p class="form-spacer"></p> """), "client", "codename", Row( Column("start_date", css_class="form-group col-md-6 mb-0"), Column("end_date", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), Row( Column("project_type", css_class="form-group col-md-6 mb-0"), Column("slack_channel", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), "update_checkouts", "note", link_css_class="project-icon", css_id="project", ), CustomTab( "Assignments", HTML(""" <p class="form-spacer"></p> """), Formset("assignments", object_context_name="Assignment"), Button( "add-assignment", "Add Assignment", css_class="btn-block btn-secondary formset-add-assign", ), HTML(""" <p class="form-spacer"></p> """), link_css_class="assignment-icon", css_id="assignments", ), CustomTab( "Objectives", HTML(""" <p class="form-spacer"></p> """), Formset("objectives", object_context_name="Objective"), Button( "add-objective", "Add Objective", css_class="btn-block btn-secondary formset-add-obj", ), HTML(""" <p class="form-spacer"></p> """), link_css_class="objective-icon", css_id="objectives", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML(""" <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """), ), )
def __init__(self, *args, **kwargs): super(ClientForm, self).__init__(*args, **kwargs) self.fields["name"].widget.attrs["placeholder"] = "SpecterOps, Inc." self.fields["name"].widget.attrs["autocomplete"] = "off" self.fields["short_name"].widget.attrs["placeholder"] = "SpecterOps" self.fields["short_name"].widget.attrs["autocomplete"] = "off" self.fields["note"].widget.attrs[ "placeholder"] = "SpecterOps was founded in 2017 and ..." # Design form layout with Crispy FormHelper self.helper = FormHelper() # Turn on <form> tags for this parent form self.helper.form_tag = True self.helper.form_show_labels = False self.helper.form_method = "post" self.helper.form_class = "newitem" self.helper.layout = Layout( TabHolder( CustomTab( "Client Information", HTML(""" <p class="form-spacer"></p> """), Row( Column("name", css_class="form-group col-md-6 mb-0"), Column("short_name", css_class="form-group col-md-6 mb-0"), css_class="form-row", ), "note", "codename", link_css_class="client-icon", css_id="client", ), CustomTab( "Points of Contact", HTML(""" <p class="form-spacer"></p> """), Formset("contacts", object_context_name="Contact"), Button( "add-contact", "Add Contact", css_class="btn-block btn-secondary formset-add-poc", ), HTML(""" <p class="form-spacer"></p> """), link_css_class="poc-icon", css_id="contacts", ), template="tab.html", css_class="nav-justified", ), ButtonHolder( Submit("submit", "Submit", css_class="btn btn-primary col-md-4"), HTML(""" <button onclick="window.location.href='{{ cancel_link }}'" class="btn btn-outline-secondary col-md-4" type="button">Cancel</button> """), ), )