@ -11,6 +11,7 @@ class Update(forms.ModelForm):
|
|||||||
model = OperatingSystem
|
model = OperatingSystem
|
||||||
fields = [
|
fields = [
|
||||||
"name",
|
"name",
|
||||||
|
'publisher',
|
||||||
'slug',
|
'slug',
|
||||||
'id',
|
'id',
|
||||||
'organization',
|
'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,
|
default = None,
|
||||||
null = True,
|
null = True,
|
||||||
blank= True
|
blank= True
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
device_type = models.ForeignKey(
|
device_type = models.ForeignKey(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ from access.fields import *
|
|||||||
from access.models import TenancyObject
|
from access.models import TenancyObject
|
||||||
|
|
||||||
from core.mixin.history_save import SaveHistory
|
from core.mixin.history_save import SaveHistory
|
||||||
|
from core.models.manufacturer import Manufacturer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -41,6 +42,14 @@ class OperatingSystemFieldsName(OperatingSystemCommonFields):
|
|||||||
|
|
||||||
class OperatingSystem(OperatingSystemFieldsName, SaveHistory):
|
class OperatingSystem(OperatingSystemFieldsName, SaveHistory):
|
||||||
|
|
||||||
|
publisher = models.ForeignKey(
|
||||||
|
Manufacturer,
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
default = None,
|
||||||
|
null = True,
|
||||||
|
blank= True
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
||||||
return self.name
|
return self.name
|
||||||
|
|||||||
@ -9,16 +9,20 @@
|
|||||||
<table class="data">
|
<table class="data">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Created</th>
|
<th>Publisher</th>
|
||||||
<th>Modified</th>
|
|
||||||
<th>Organization</th>
|
<th>Organization</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for operating_system in operating_systems %}
|
{% for operating_system in operating_systems %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{% url 'ITAM:_operating_system_view' pk=operating_system.id %}">{{ operating_system.name }}</a></td>
|
<td><a href="{% url 'ITAM:_operating_system_view' pk=operating_system.id %}">{{ operating_system.name }}</a></td>
|
||||||
<td>{{ operating_system.created }}</td>
|
<td>
|
||||||
<td>{{ operating_system.modified }}</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>{% 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>
|
<td><a href="{% url 'ITAM:_operating_system_delete' pk=operating_system.id %}">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -98,6 +98,7 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
|||||||
template_name = 'form.html.j2'
|
template_name = 'form.html.j2'
|
||||||
fields = [
|
fields = [
|
||||||
'name',
|
'name',
|
||||||
|
'publisher',
|
||||||
'organization',
|
'organization',
|
||||||
'is_global'
|
'is_global'
|
||||||
]
|
]
|
||||||
@ -111,9 +112,6 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**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'
|
context['content_title'] = 'Add Operating System'
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|||||||
Reference in New Issue
Block a user