|
@@ -263,29 +263,36 @@ class ProjectCreateView(SetHeadlineMixin
|
|
|
}
|
|
|
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
|
|
|
class ProjectUpdateView(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class ProjectUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for modifying an existing project.
|
|
|
"""
|
|
|
|
|
|
model = Project
|
|
|
form_class = ProjectForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
template_name = "conntrackt/update_form.html"
|
|
|
|
|
|
# Required permissions.
|
|
|
permissions = {
|
|
|
"all": ("conntrackt.change_project",),
|
|
|
}
|
|
|
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
def get_headline(self):
|
|
|
"""
|
|
|
Set headline based on project name.
|
|
|
"""
|
|
|
|
|
|
return "Update project %s" % self.object.name
|
|
|
|
|
|
|
|
|
class ProjectDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting a project.
|
|
|
"""
|
|
|
|
|
@@ -330,31 +337,38 @@ class LocationCreateView(SetHeadlineMixi
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
success_url = reverse_lazy("index")
|
|
|
|
|
|
|
|
|
class LocationUpdateView(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class LocationUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for modifying an existing location.
|
|
|
"""
|
|
|
|
|
|
model = Location
|
|
|
form_class = LocationForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
template_name = "conntrackt/update_form.html"
|
|
|
|
|
|
# Required permissions.
|
|
|
permissions = {
|
|
|
"all": ("conntrackt.change_location",),
|
|
|
}
|
|
|
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
success_url = reverse_lazy("index")
|
|
|
|
|
|
def get_headline(self):
|
|
|
"""
|
|
|
Set headline based on location name.
|
|
|
"""
|
|
|
|
|
|
return "Update location %s" % self.object.name
|
|
|
|
|
|
|
|
|
class LocationDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting a location.
|
|
|
"""
|
|
|
|
|
@@ -434,29 +448,36 @@ class EntityCreateView(SetHeadlineMixin,
|
|
|
initial["project"] = self.request.GET.get("project", None)
|
|
|
initial["location"] = self.request.GET.get("location", None)
|
|
|
|
|
|
return initial
|
|
|
|
|
|
|
|
|
class EntityUpdateView(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class EntityUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing entity.
|
|
|
"""
|
|
|
|
|
|
model = Entity
|
|
|
form_class = EntityForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
template_name = "conntrackt/update_form.html"
|
|
|
|
|
|
# Required permissions.
|
|
|
permissions = {
|
|
|
"all": ("conntrackt.change_entity",),
|
|
|
}
|
|
|
|
|
|
# Raise authorisation denied exception for unmet permissions.
|
|
|
raise_exception = True
|
|
|
|
|
|
def get_headline(self):
|
|
|
"""
|
|
|
Set headline based on entity name.
|
|
|
"""
|
|
|
|
|
|
return "Update entity %s" % self.object.name
|
|
|
|
|
|
|
|
|
class EntityDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an entity.
|
|
|
"""
|
|
|
|
|
@@ -549,20 +570,20 @@ 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(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class InterfaceUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing interface.
|
|
|
"""
|
|
|
|
|
|
model = Interface
|
|
|
form_class = InterfaceForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
template_name = "conntrackt/update_form.html"
|
|
|
|
|
|
# Required permissions.
|
|
|
permissions = {
|
|
|
"all": ("conntrackt.change_interface",),
|
|
|
}
|
|
|
|
|
@@ -592,12 +613,19 @@ class InterfaceUpdateView(MultiplePermis
|
|
|
|
|
|
The URL in this case will be set to entity's details page.
|
|
|
"""
|
|
|
|
|
|
return reverse("entity", args=(self.object.entity.pk,))
|
|
|
|
|
|
def get_headline(self):
|
|
|
"""
|
|
|
Set headline based on interface name.
|
|
|
"""
|
|
|
|
|
|
return "Update interface %s" % self.object.name
|
|
|
|
|
|
|
|
|
class InterfaceDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an interface.
|
|
|
"""
|
|
|
|
|
@@ -716,20 +744,20 @@ class CommunicationCreateView(SetHeadlin
|
|
|
to project page to which the communication belongs.
|
|
|
"""
|
|
|
|
|
|
return self.request.GET.get("next", reverse("project", args=(self.object.source.entity.project.pk,)))
|
|
|
|
|
|
|
|
|
class CommunicationUpdateView(MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
class CommunicationUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
|
|
|
"""
|
|
|
View for updating an existing communication.
|
|
|
"""
|
|
|
|
|
|
model = Communication
|
|
|
form_class = CommunicationForm
|
|
|
template_name_suffix = "_update_form"
|
|
|
template_name = "conntrackt/update_form.html"
|
|
|
|
|
|
# Required permissions.
|
|
|
permissions = {
|
|
|
"all": ("conntrackt.change_communication",),
|
|
|
}
|
|
|
|
|
@@ -763,12 +791,19 @@ class CommunicationUpdateView(MultiplePe
|
|
|
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,)))
|
|
|
|
|
|
def get_headline(self):
|
|
|
"""
|
|
|
Set headline based on communication.
|
|
|
"""
|
|
|
|
|
|
return "Update communication %s" % self.object
|
|
|
|
|
|
|
|
|
class CommunicationDeleteView(MultiplePermissionsRequiredMixin, DeleteView):
|
|
|
"""
|
|
|
View for deleting an communication.
|
|
|
"""
|
|
|
|