@ -34,16 +34,17 @@
|
|||||||
<button id="defaultOpen" class="tablinks" onclick="openCity(event, 'Details')">Details</button>
|
<button id="defaultOpen" class="tablinks" onclick="openCity(event, 'Details')">Details</button>
|
||||||
<button class="tablinks" onclick="openCity(event, 'Versions')">Versions</button>
|
<button class="tablinks" onclick="openCity(event, 'Versions')">Versions</button>
|
||||||
<button class="tablinks" onclick="openCity(event, 'Licences')">Licences</button>
|
<button class="tablinks" onclick="openCity(event, 'Licences')">Licences</button>
|
||||||
|
<button class="tablinks" onclick="openCity(event, 'Notes')">Notes</button>
|
||||||
<button class="tablinks" onclick="openCity(event, 'Installations')">Installations</button>
|
<button class="tablinks" onclick="openCity(event, 'Installations')">Installations</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
<div id="Details" class="tabcontent">
|
<div id="Details" class="tabcontent">
|
||||||
<h3>Details</h3>
|
<h3>Details</h3>
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form }}
|
{{ form }}
|
||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("defaultOpen").click();
|
document.getElementById("defaultOpen").click();
|
||||||
@ -106,6 +107,23 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="Notes" class="tabcontent">
|
||||||
|
<h3>
|
||||||
|
Notes
|
||||||
|
</h3>
|
||||||
|
{{ notes_form }}
|
||||||
|
<input type="submit" name="{{notes_form.prefix}}" value="Submit" />
|
||||||
|
<div class="comments">
|
||||||
|
{% if notes %}
|
||||||
|
{% for note in notes%}
|
||||||
|
{% include 'note.html.j2' %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="Installations" class="tabcontent">
|
<div id="Installations" class="tabcontent">
|
||||||
<h3>Installations</h3>
|
<h3>Installations</h3>
|
||||||
<table>
|
<table>
|
||||||
@ -133,5 +151,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -5,6 +5,9 @@ from django.views import generic
|
|||||||
|
|
||||||
from access.mixin import OrganizationPermission
|
from access.mixin import OrganizationPermission
|
||||||
|
|
||||||
|
from core.forms.comment import AddNoteForm
|
||||||
|
from core.models.notes import Notes
|
||||||
|
|
||||||
from itam.models.device import DeviceOperatingSystem
|
from itam.models.device import DeviceOperatingSystem
|
||||||
from itam.models.operating_system import OperatingSystem, OperatingSystemVersion
|
from itam.models.operating_system import OperatingSystem, OperatingSystemVersion
|
||||||
from itam.forms.operating_system.update import Update
|
from itam.forms.operating_system.update import Update
|
||||||
@ -51,10 +54,32 @@ class View(OrganizationPermission, generic.UpdateView):
|
|||||||
installs = DeviceOperatingSystem.objects.filter(operating_system_version__operating_system_id=self.kwargs['pk'])
|
installs = DeviceOperatingSystem.objects.filter(operating_system_version__operating_system_id=self.kwargs['pk'])
|
||||||
context['installs'] = installs
|
context['installs'] = installs
|
||||||
|
|
||||||
|
context['notes_form'] = AddNoteForm(prefix='note')
|
||||||
|
|
||||||
|
context['notes'] = Notes.objects.filter(operatingsystem=self.kwargs['pk'])
|
||||||
|
|
||||||
context['content_title'] = self.object.name
|
context['content_title'] = self.object.name
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
|
||||||
|
operatingsystem = OperatingSystem.objects.get(pk=self.kwargs['pk'])
|
||||||
|
|
||||||
|
notes = AddNoteForm(request.POST, prefix='note')
|
||||||
|
|
||||||
|
if notes.is_bound and notes.is_valid():
|
||||||
|
|
||||||
|
notes.instance.organization = operatingsystem.organization
|
||||||
|
notes.instance.operatingsystem = operatingsystem
|
||||||
|
notes.instance.usercreated = request.user
|
||||||
|
|
||||||
|
notes.save()
|
||||||
|
|
||||||
|
return super().post(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def get_success_url(self, **kwargs):
|
def get_success_url(self, **kwargs):
|
||||||
|
|
||||||
return reverse('ITAM:_operating_system_view', args=(self.kwargs['pk'],))
|
return reverse('ITAM:_operating_system_view', args=(self.kwargs['pk'],))
|
||||||
|
Reference in New Issue
Block a user