diff --git a/app/itam/templates/itam/software.html.j2 b/app/itam/templates/itam/software.html.j2 index 0d7b5bf1..4edf5cd0 100644 --- a/app/itam/templates/itam/software.html.j2 +++ b/app/itam/templates/itam/software.html.j2 @@ -68,7 +68,7 @@ {% for version in software_versions %} - {{ version.name }} + {{ version.name }} {% include 'icons/issue_link.html.j2' with issue=2 %} {% include 'icons/issue_link.html.j2' with issue=3 %}   diff --git a/app/itam/urls.py b/app/itam/urls.py index 9138a83c..67f7ea8d 100644 --- a/app/itam/urls.py +++ b/app/itam/urls.py @@ -21,6 +21,7 @@ urlpatterns = [ path("software//", software.View.as_view(), name="_software_view"), path("software//delete", software.Delete.as_view(), name="_software_delete"), path("software//version/add", software_version.Add.as_view(), name="_software_version_add"), + path("software//version/", software_version.View.as_view(), name="_software_version_view"), path("software/add/", software.Add.as_view(), name="_software_add"), path("software_category/add/", software_category.Add.as_view(), name="_software_category_add"), diff --git a/app/itam/views/software_version.py b/app/itam/views/software_version.py index c07461a7..65a88e21 100644 --- a/app/itam/views/software_version.py +++ b/app/itam/views/software_version.py @@ -6,6 +6,29 @@ from access.mixin import OrganizationPermission from ..models.software import Software, SoftwareVersion +class View(OrganizationPermission, generic.UpdateView): + model = SoftwareVersion + permission_required = [ + 'itam.view_softwareversion' + ] + template_name = 'form.html.j2' + + fields = [ + "name", + ] + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + context['content_title'] = self.object.name + + return context + + def get_success_url(self, **kwargs): + + return f"/itam/software/{self.kwargs['software_id']}/" + + class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView): model = SoftwareVersion