From 3b90c670632c7d544ff84f3354ae7ffd12380bc0 Mon Sep 17 00:00:00 2001 From: Eric Theise Date: Tue, 31 Mar 2020 13:38:21 -0700 Subject: [PATCH] feat: addresses #19, adds Niche to API --- mdi/serializers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mdi/serializers.py b/mdi/serializers.py index 3a54765..6988852 100644 --- a/mdi/serializers.py +++ b/mdi/serializers.py @@ -1,7 +1,7 @@ from rest_framework import serializers from accounts.models import User, Source from django.contrib.auth.models import Group -from mdi.models import Organization, SocialNetwork, Sector, Tool, License, Language +from mdi.models import Organization, SocialNetwork, Sector, Tool, License, Language, Niche from rest_framework_gis.serializers import GeoFeatureModelSerializer from django_countries.serializers import CountryFieldMixin @@ -25,7 +25,6 @@ class Meta: 'country', 'url', 'bio', - 'notes', 'source', ) @@ -54,9 +53,16 @@ class Meta: fields = ('spdx', 'name', 'url',) +class NicheSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = Niche + fields = ('name', 'description',) + + class ToolSerializer(serializers.HyperlinkedModelSerializer): license = serializers.StringRelatedField() pricing = serializers.StringRelatedField() + niches = NicheSerializer(many=True) languages_supported = LanguageSerializer(many=True) sectors = serializers.StringRelatedField(many=True) @@ -68,9 +74,9 @@ class Meta: 'url', 'license', 'pricing', + 'niches', 'languages_supported', 'sectors', - 'notes', )