Skip to content

Commit

Permalink
feat(itam): Add Software Version Base Serializer
Browse files Browse the repository at this point in the history
ref: #248 #348
  • Loading branch information
jon-nfc committed Nov 27, 2024
1 parent 99550e7 commit 5ab7ce0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/config_management/serializers/config_group_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from config_management.serializers.config_group import ConfigGroups, ConfigGroupBaseSerializer

from itam.serializers.software import SoftwareBaseSerializer
from itam.serializers.software_version import SoftwareVersion, SoftwareVersionBaseSerializer



Expand Down Expand Up @@ -213,3 +214,5 @@ class ConfigGroupSoftwareViewSerializer(ConfigGroupSoftwareModelSerializer):
organization = OrganizationBaseSerializer( many=False, read_only=True )

software = SoftwareBaseSerializer( read_only = True )

version = SoftwareVersionBaseSerializer( read_only = True )
31 changes: 31 additions & 0 deletions app/itam/serializers/software_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from rest_framework.reverse import reverse
from rest_framework import serializers

from access.serializers.organization import OrganizationBaseSerializer
from itam.models.software import SoftwareVersion



class SoftwareVersionBaseSerializer(serializers.ModelSerializer):

display_name = serializers.SerializerMethodField('get_display_name')

def get_display_name(self, item):

return str( item )

class Meta:

model = SoftwareVersion

fields = [
'id',
'display_name',
'name',
]

read_only_fields = [
'id',
'display_name',
'name',
]

0 comments on commit 5ab7ce0

Please sign in to comment.