feat(itam): Add publisher to software

!10 #12
This commit is contained in:
2024-05-23 22:21:10 +09:30
parent 53baeb59c9
commit 2fcbb1ead7
5 changed files with 39 additions and 1 deletions

View File

@ -10,6 +10,7 @@ class Update(forms.ModelForm):
model = Software
fields = [
"name",
'publisher',
'slug',
'id',
'organization',

View File

@ -0,0 +1,20 @@
# Generated by Django 5.0.6 on 2024-05-23 12:49
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_manufacturer'),
('itam', '0010_operatingsystem_publisher_software_publisher'),
]
operations = [
migrations.AddField(
model_name='software',
name='publisher',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.manufacturer'),
),
]

View File

@ -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
class SoftwareCommonFields(TenancyObject, models.Model):
@ -41,6 +42,14 @@ class SoftwareCategory(SoftwareCommonFields, SaveHistory):
class Software(SoftwareCommonFields, SaveHistory):
publisher = models.ForeignKey(
Manufacturer,
on_delete=models.CASCADE,
default = None,
null = True,
blank= True
)
category = models.ForeignKey(
SoftwareCategory,
on_delete=models.CASCADE,

View File

@ -6,10 +6,10 @@
{% block body %}
<input type="button" value="New Software" onclick="window.location='{% url 'ITAM:_software_add' %}';">
<input type="button" value="New Category" onclick="window.location='{% url 'ITAM:_software_category_add' %}';">
<table class="data">
<tr>
<th>Name</th>
<th>Publisher</th>
<th>Category</th>
<th>Created</th>
<th>Modified</th>
@ -19,6 +19,13 @@
{% for software in softwares %}
<tr>
<td><a href="{% url 'ITAM:_software_view' pk=software.id %}">{{ software.name }}</a></td>
<td>
{% if software.publisher %}
<a href="{% url 'Settings:_manufacturer_view' pk=software.publisher.id %}">{{ software.publisher }}</a>
{% else %}
-
{% endif %}
</td>
<td>{{ software.category }}</td>
<td>{{ software.created }}</td>
<td>{{ software.modified }}</td>

View File

@ -118,6 +118,7 @@ class Add(PermissionRequiredMixin, OrganizationPermission, generic.CreateView):
template_name = 'form.html.j2'
fields = [
'name',
'publisher',
'category',
'organization',
'is_global'