@ -11,6 +11,7 @@ class Update(forms.ModelForm):
|
||||
model = OperatingSystem
|
||||
fields = [
|
||||
"name",
|
||||
'publisher',
|
||||
'slug',
|
||||
'id',
|
||||
'organization',
|
||||
|
@ -0,0 +1,20 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-23 12:48
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0005_manufacturer'),
|
||||
('itam', '0009_devicemodel_device_device_model'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='operatingsystem',
|
||||
name='publisher',
|
||||
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.manufacturer'),
|
||||
),
|
||||
]
|
@ -47,7 +47,6 @@ class Device(DeviceCommonFieldsName, SaveHistory):
|
||||
default = None,
|
||||
null = True,
|
||||
blank= True
|
||||
|
||||
)
|
||||
|
||||
device_type = models.ForeignKey(
|
||||
|
@ -4,6 +4,7 @@ from access.fields import *
|
||||
from access.models import TenancyObject
|
||||
|
||||
from core.mixin.history_save import SaveHistory
|
||||
from core.models.manufacturer import Manufacturer
|
||||
|
||||
|
||||
|
||||
@ -41,6 +42,14 @@ class OperatingSystemFieldsName(OperatingSystemCommonFields):
|
||||
|
||||
class OperatingSystem(OperatingSystemFieldsName, SaveHistory):
|
||||
|
||||
publisher = models.ForeignKey(
|
||||
Manufacturer,
|
||||
on_delete=models.CASCADE,
|
||||
default = None,
|
||||
null = True,
|
||||
blank= True
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return self.name
|
||||
|
@ -9,16 +9,20 @@
|
||||
<table class="data">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Created</th>
|
||||
<th>Modified</th>
|
||||
<th>Publisher</th>
|
||||
<th>Organization</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
{% for operating_system in operating_systems %}
|
||||
<tr>
|
||||
<td><a href="{% url 'ITAM:_operating_system_view' pk=operating_system.id %}">{{ operating_system.name }}</a></td>
|
||||
<td>{{ operating_system.created }}</td>
|
||||
<td>{{ operating_system.modified }}</td>
|
||||
<td>
|
||||
{% if operating_system.publisher %}
|
||||
<a href="{% url 'Settings:_manufacturer_view' pk=operating_system.publisher.id %}">{{ operating_system.publisher }}</a>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{% if operating_system.is_global %}Global{% else %}{{ operating_system.organization }}{% endif %}</td>
|
||||
<td><a href="{% url 'ITAM:_operating_system_delete' pk=operating_system.id %}">Delete</a></td>
|
||||
</tr>
|
||||
|
@ -98,6 +98,7 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
||||
template_name = 'form.html.j2'
|
||||
fields = [
|
||||
'name',
|
||||
'publisher',
|
||||
'organization',
|
||||
'is_global'
|
||||
]
|
||||
@ -111,9 +112,6 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
context['model_pk'] = self.kwargs['pk']
|
||||
context['model_name'] = self.model._meta.verbose_name.replace(' ', '')
|
||||
|
||||
context['content_title'] = 'Add Operating System'
|
||||
|
||||
return context
|
||||
|
Reference in New Issue
Block a user