|
@@ -14,7 +14,7 @@ from django.views.generic import Templat
|
|
|
from braces.views import MultiplePermissionsRequiredMixin
|
|
|
|
|
|
# Application imports.
|
|
|
from .forms import EntityForm, InterfaceForm, CommunicationForm, ProjectForm
|
|
|
from .forms import ProjectForm, LocationForm, EntityForm, InterfaceForm, CommunicationForm
|
|
|
from .models import Project, Entity, Location, Interface, Communication
|
|
|
from .utils import generate_entity_iptables
|
|
|
|
|
@@ -317,6 +317,7 @@ class LocationCreateView(MultiplePermiss
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
form_class = LocationForm
|
|
|
template_name_suffix = "_create_form"
|
|
|
|
|
|
# Required permissions.
|
|
@@ -329,20 +330,6 @@ class LocationCreateView(MultiplePermiss
|
|
|
|
|
|
success_url = reverse_lazy("index")
|
|
|
|
|
|
def get_form(self, form_class):
|
|
|
"""
|
|
|
Implements an override for the default form constructed for the create
|
|
|
view that includes some better styling of input widgets.
|
|
|
"""
|
|
|
|
|
|
form = super(LocationCreateView, self).get_form(form_class)
|
|
|
form.fields["name"].widget.attrs["class"] = "span6"
|
|
|
form.fields["name"].widget.attrs["placeholder"] = "New Location"
|
|
|
form.fields["description"].widget.attrs["class"] = "span6"
|
|
|
form.fields["description"].widget.attrs["placeholder"] = "Description for new location."
|
|
|
|
|
|
return form
|
|
|
|
|
|
|
|
|
class LocationUpdateView(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
@@ -350,6 +337,7 @@ class LocationUpdateView(MultiplePermiss
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
form_class = LocationForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
|
|
|
# Required permissions.
|
|
@@ -362,20 +350,6 @@ class LocationUpdateView(MultiplePermiss
|
|
|
|
|
|
success_url = reverse_lazy("index")
|
|
|
|
|
|
def get_form(self, form_class):
|
|
|
"""
|
|
|
Implements an override for the default form constructed for the create
|
|
|
view that includes some better styling of input widgets.
|
|
|
"""
|
|
|
|
|
|
form = super(LocationUpdateView, self).get_form(form_class)
|
|
|
form.fields["name"].widget.attrs["class"] = "span6"
|
|
|
form.fields["name"].widget.attrs["placeholder"] = "Location name"
|
|
|
form.fields["description"].widget.attrs["class"] = "span6"
|
|
|
form.fields["description"].widget.attrs["placeholder"] = "Description for location."
|
|
|
|
|
|
return form
|
|
|
|
|
|
|
|
|
class LocationDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|