wip installation model

This commit is contained in:
Hedde van der Heide
2021-12-08 15:36:47 +01:00
parent 76b0dd2c5d
commit 92a1a58eb0
12 changed files with 430 additions and 19 deletions
+17 -1
View File
@@ -5,7 +5,7 @@ from netbox.api.serializers import PrimaryModelSerializer, OrganizationalModelSe
# NestedRecordSerializer,
# NestedNameServerSerializer,
# )
from netbox_slm.models import SoftwareProduct
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion
class SoftwareProductSerializer(PrimaryModelSerializer):
@@ -22,3 +22,19 @@ class SoftwareProductSerializer(PrimaryModelSerializer):
def get_display(self, obj):
return obj.name
class SoftwareProductVersionSerializer(PrimaryModelSerializer):
display = serializers.SerializerMethodField()
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_slm-api:softwareproductversion-detail"
)
class Meta:
model = SoftwareProductVersion
fields = [
'id', 'display', 'url', 'name', 'software_product', 'tags', 'custom_field_data', 'created', 'last_updated',
]
def get_display(self, obj):
return obj.name