|
@@ -266,13 +266,13 @@ def project_iptables(request, project_id
|
|
|
response['Content-Disposition'] = 'attachment; filename="%s"' % filename
|
|
|
|
|
|
# Finally return the response object.
|
|
|
return response
|
|
|
|
|
|
|
|
|
class ProjectCreateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
class ProjectCreateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
"""
|
|
|
View for creating a new project.
|
|
|
"""
|
|
|
|
|
|
model = Project
|
|
|
form_class = ProjectForm
|
|
@@ -285,13 +285,13 @@ class ProjectCreateView(SetHeadlineMixin
|
|
|
}
|
|
|
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
|
|
|
class ProjectUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class ProjectUpdateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for modifying an existing project.
|
|
|
"""
|
|
|
|
|
|
model = Project
|
|
|
form_class = ProjectForm
|
|
@@ -310,13 +310,13 @@ class ProjectUpdateView(SetHeadlineMixin
|
|
|
Set headline based on project name.
|
|
|
"""
|
|
|
|
|
|
return "Update project %s" % self.object.name
|
|
|
|
|
|
|
|
|
class ProjectDeleteView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
class ProjectDeleteView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting a project.
|
|
|
"""
|
|
|
|
|
|
model = Project
|
|
|
template_name = "conntrackt/delete_form.html"
|
|
@@ -346,13 +346,13 @@ class ProjectDeleteView(SetHeadlineMixin
|
|
|
Set headline based on project name.
|
|
|
"""
|
|
|
|
|
|
return "Delete project %s" % self.object.name
|
|
|
|
|
|
|
|
|
class LocationCreateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
class LocationCreateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
"""
|
|
|
View for creating a new location.
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
form_class = LocationForm
|
|
@@ -367,13 +367,13 @@ class LocationCreateView(SetHeadlineMixi
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
success_url = reverse_lazy("index")
|
|
|
|
|
|
|
|
|
class LocationUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class LocationUpdateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for modifying an existing location.
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
form_class = LocationForm
|
|
@@ -394,13 +394,13 @@ class LocationUpdateView(SetHeadlineMixi
|
|
|
Set headline based on location name.
|
|
|
"""
|
|
|
|
|
|
return "Update location %s" % self.object.name
|
|
|
|
|
|
|
|
|
class LocationDeleteView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
class LocationDeleteView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting a location.
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
template_name = "conntrackt/delete_form.html"
|
|
@@ -430,13 +430,13 @@ class LocationDeleteView(SetHeadlineMixi
|
|
|
Set headline based on location name.
|
|
|
"""
|
|
|
|
|
|
return "Delete location %s" % self.object.name
|
|
|
|
|
|
|
|
|
class EntityCreateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
class EntityCreateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
"""
|
|
|
View for creating a new entity.
|
|
|
"""
|
|
|
|
|
|
model = Entity
|
|
|
form_class = EntityForm
|
|
@@ -486,13 +486,13 @@ class EntityCreateView(SetHeadlineMixin,
|
|
|
initial["project"] = self.request.GET.get("project", None)
|
|
|
initial["location"] = self.request.GET.get("location", None)
|
|
|
|
|
|
return initial
|
|
|
|
|
|
|
|
|
class EntityUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class EntityUpdateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing entity.
|
|
|
"""
|
|
|
|
|
|
model = Entity
|
|
|
form_class = EntityForm
|
|
@@ -511,13 +511,13 @@ class EntityUpdateView(SetHeadlineMixin,
|
|
|
Set headline based on entity name.
|
|
|
"""
|
|
|
|
|
|
return "Update entity %s" % self.object.name
|
|
|
|
|
|
|
|
|
class EntityDeleteView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
class EntityDeleteView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an entity.
|
|
|
"""
|
|
|
|
|
|
model = Entity
|
|
|
template_name = "conntrackt/delete_form.html"
|
|
@@ -557,13 +557,13 @@ class EntityDeleteView(SetHeadlineMixin,
|
|
|
Set headline based on entity name.
|
|
|
"""
|
|
|
|
|
|
return "Delete entity %s" % self.object.name
|
|
|
|
|
|
|
|
|
class InterfaceCreateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
class InterfaceCreateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
"""
|
|
|
View for creating a new interface.
|
|
|
"""
|
|
|
|
|
|
model = Interface
|
|
|
form_class = InterfaceForm
|
|
@@ -616,13 +616,13 @@ class InterfaceCreateView(SetHeadlineMix
|
|
|
The URL in this case will be set to entity's details page.
|
|
|
"""
|
|
|
|
|
|
return reverse("entity", args=(self.object.entity.pk,))
|
|
|
|
|
|
|
|
|
class InterfaceUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class InterfaceUpdateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing interface.
|
|
|
"""
|
|
|
|
|
|
model = Interface
|
|
|
form_class = InterfaceForm
|
|
@@ -667,13 +667,13 @@ class InterfaceUpdateView(SetHeadlineMix
|
|
|
Set headline based on interface name.
|
|
|
"""
|
|
|
|
|
|
return "Update interface %s" % self.object.name
|
|
|
|
|
|
|
|
|
class InterfaceDeleteView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
class InterfaceDeleteView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an interface.
|
|
|
"""
|
|
|
|
|
|
model = Interface
|
|
|
template_name = "conntrackt/delete_form.html"
|
|
@@ -713,13 +713,13 @@ class InterfaceDeleteView(SetHeadlineMix
|
|
|
Set headline based on interface name.
|
|
|
"""
|
|
|
|
|
|
return "Delete interface %s" % self.object.name
|
|
|
|
|
|
|
|
|
class CommunicationCreateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
class CommunicationCreateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, CreateView):
|
|
|
"""
|
|
|
View for creating a new communication.
|
|
|
"""
|
|
|
|
|
|
model = Communication
|
|
|
form_class = CommunicationForm
|
|
@@ -795,16 +795,23 @@ class CommunicationCreateView(SetHeadlin
|
|
|
communication has been created.
|
|
|
|
|
|
The URL will either point to value provided via GET parameter "next", or
|
|
|
to project page to which the communication belongs.
|
|
|
"""
|
|
|
|
|
|
return self.request.GET.get("next", reverse("project", args=(self.object.source.entity.project.pk,)))
|
|
|
# We must set the success URL to something first.
|
|
|
self.success_url = reverse("project", args=(self.object.source.entity.project.pk,))
|
|
|
|
|
|
# This will override the URL if parameter "next" was provided (from
|
|
|
# RedirectToNextMixin).
|
|
|
success_url = super(CommunicationCreateView, self).get_success_url()
|
|
|
|
|
|
return success_url
|
|
|
|
|
|
|
|
|
class CommunicationUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class CommunicationUpdateView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing communication.
|
|
|
"""
|
|
|
|
|
|
model = Communication
|
|
|
form_class = CommunicationForm
|
|
@@ -853,13 +860,13 @@ class CommunicationUpdateView(SetHeadlin
|
|
|
Set headline based on communication.
|
|
|
"""
|
|
|
|
|
|
return "Update communication %s" % self.object
|
|
|
|
|
|
|
|
|
class CommunicationDeleteView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
class CommunicationDeleteView(RedirectToNextMixin, SetHeadlineMixin, MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an communication.
|
|
|
"""
|
|
|
|
|
|
model = Communication
|
|
|
template_name = "conntrackt/delete_form.html"
|