Skip to content

Commit

Permalink
refactor: addresses #7 and #17, updates & simplifies serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
erictheise committed Mar 25, 2020
1 parent 2229bdc commit afd80d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mdi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class License(models.Model):
updated_at = models.DateTimeField(auto_now=True)

class Meta:
ordering = ['spdx',]
ordering = ['spdx', ]

def __str__(self):
return self.spdx
Expand Down
10 changes: 6 additions & 4 deletions mdi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class Meta:


class ToolSerializer(serializers.HyperlinkedModelSerializer):
license = serializers.StringRelatedField(source='license.spdx')
pricing = serializers.StringRelatedField(source='pricing.name')
license = serializers.StringRelatedField()
pricing = serializers.StringRelatedField()
languages_supported = LanguageSerializer(many=True)
sectors = serializers.StringRelatedField(many=True)

Expand All @@ -76,8 +76,9 @@ class Meta:

class OrganizationSerializer(CountryFieldMixin, GeoFeatureModelSerializer):
categories = serializers.StringRelatedField(many=True)
source = serializers.StringRelatedField(source='source.name')
type = serializers.StringRelatedField(source='type.name')
source = serializers.StringRelatedField()
stage = serializers.StringRelatedField()
type = serializers.StringRelatedField()
sectors = serializers.StringRelatedField(many=True)

class Meta:
Expand All @@ -97,4 +98,5 @@ class Meta:
'country',
'url',
'source',
'stage',
)

0 comments on commit afd80d9

Please sign in to comment.