Add new fields to models and upgrade to NetBox v3.7.2 (#36)
Closes #10, #26, #35
This commit is contained in:
@@ -4,6 +4,39 @@ from netbox.api.serializers import NetBoxModelSerializer
|
||||
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense
|
||||
|
||||
|
||||
class SoftwareLicenseSerializer(NetBoxModelSerializer):
|
||||
display = serializers.SerializerMethodField()
|
||||
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_slm-api:softwarelicense-detail")
|
||||
|
||||
class Meta:
|
||||
model = SoftwareLicense
|
||||
fields = [
|
||||
"id",
|
||||
"display",
|
||||
"url",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"stored_location",
|
||||
"stored_location_url",
|
||||
"start_date",
|
||||
"expiration_date",
|
||||
"support",
|
||||
"license_amount",
|
||||
"software_product",
|
||||
"version",
|
||||
"installation",
|
||||
"tags",
|
||||
"comments",
|
||||
"custom_field_data",
|
||||
"created",
|
||||
"last_updated",
|
||||
]
|
||||
|
||||
def get_display(self, obj):
|
||||
return f"{obj}"
|
||||
|
||||
|
||||
class SoftwareProductSerializer(NetBoxModelSerializer):
|
||||
display = serializers.SerializerMethodField()
|
||||
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_slm-api:softwareproduct-detail")
|
||||
@@ -15,7 +48,10 @@ class SoftwareProductSerializer(NetBoxModelSerializer):
|
||||
"display",
|
||||
"url",
|
||||
"name",
|
||||
"manufacturer",
|
||||
"description",
|
||||
"tags",
|
||||
"comments",
|
||||
"custom_field_data",
|
||||
"created",
|
||||
"last_updated",
|
||||
@@ -25,28 +61,6 @@ class SoftwareProductSerializer(NetBoxModelSerializer):
|
||||
return f"{obj.manufacturer} - {obj}"
|
||||
|
||||
|
||||
class SoftwareProductVersionSerializer(NetBoxModelSerializer):
|
||||
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 f"{obj}"
|
||||
|
||||
|
||||
class SoftwareProductInstallationSerializer(NetBoxModelSerializer):
|
||||
display = serializers.SerializerMethodField()
|
||||
url = serializers.HyperlinkedIdentityField(
|
||||
@@ -65,6 +79,7 @@ class SoftwareProductInstallationSerializer(NetBoxModelSerializer):
|
||||
"software_product",
|
||||
"version",
|
||||
"tags",
|
||||
"comments",
|
||||
"custom_field_data",
|
||||
"created",
|
||||
"last_updated",
|
||||
@@ -74,26 +89,27 @@ class SoftwareProductInstallationSerializer(NetBoxModelSerializer):
|
||||
return f"{obj}"
|
||||
|
||||
|
||||
class SoftwareLicenseSerializer(NetBoxModelSerializer):
|
||||
class SoftwareProductVersionSerializer(NetBoxModelSerializer):
|
||||
display = serializers.SerializerMethodField()
|
||||
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_slm-api:softwarelicense-detail")
|
||||
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_slm-api:softwareproductversion-detail")
|
||||
|
||||
class Meta:
|
||||
model = SoftwareLicense
|
||||
model = SoftwareProductVersion
|
||||
fields = [
|
||||
"id",
|
||||
"display",
|
||||
"url",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"stored_location",
|
||||
"start_date",
|
||||
"expiration_date",
|
||||
"release_date",
|
||||
"documentation_url",
|
||||
"end_of_support",
|
||||
"filename",
|
||||
"file_checksum",
|
||||
"file_link",
|
||||
"release_type",
|
||||
"software_product",
|
||||
"version",
|
||||
"installation",
|
||||
"tags",
|
||||
"comments",
|
||||
"custom_field_data",
|
||||
"created",
|
||||
"last_updated",
|
||||
|
||||
Reference in New Issue
Block a user