Skip to content

Commit

Permalink
Adding serializer for ComputingFacility class. Addresses #38.
Browse files Browse the repository at this point in the history
  • Loading branch information
joncison committed Aug 12, 2020
1 parent e6217c9 commit 735f4b8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ifbcatsandbox_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,36 @@ def validate_topics(self, topics):
'Syntax: ^https?://edamontology.org/topic_[0-9]{4}$'
)
return topics


# Model serializer for computing facilities
class ComputingFacilitySerializer(serializers.HyperlinkedModelSerializer):
"""Serializes a computing facility (ComputingFacility object)."""

class Meta:
model = models.ComputingFacility

fields = (
'id',
'user_profile',
'homepage',
# 'providedBy',
# 'team',
'accessibility',
'requestAccount',
'termsOfUse',
'trainingMaterials',
'serverDescription',
'storageTb',
'cpuCores',
'ramGb',
'ramPerCoreGb',
'cpuHoursYearly',
'usersYearly',
)

extra_kwargs = {
'user_profile': {'read_only': True},
'serverDescription': {'style': {'rows': 4, 'base_template': 'textarea.html'}},
'trainingMaterials': {'lookup_field': 'name'},
}

0 comments on commit 735f4b8

Please sign in to comment.