Skip to content

Commit

Permalink
fix: properly serialize Country for individuals, impacts #7 and #17
Browse files Browse the repository at this point in the history
  • Loading branch information
erictheise committed Mar 20, 2020
1 parent 54c3996 commit e4a8ab7
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions mdi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,34 @@
from django_countries.serializers import CountryFieldMixin


# class UserSerializer(CountryFieldMixin, GeoFeatureModelSerializer):
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = (
'id',
'email',
'first_name',
'middle_name',
'last_name',
'address',
'city',
'state',
'postal_code',
'country',
'url',
'bio',
'notes'
)
class UserSerializer(CountryFieldMixin, GeoFeatureModelSerializer):
source = serializers.StringRelatedField(source='source.name')

class Meta:
model = User
geo_field = 'geom'
fields = (
'id',
'email',
'first_name',
'middle_name',
'last_name',
'address',
'city',
'state',
'postal_code',
'country',
'url',
'bio',
'notes',
'source',
)


class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ('id', 'name')
class Meta:
model = Group
fields = ('id', 'name')


class SectorSerializer(serializers.HyperlinkedModelSerializer):
Expand Down

0 comments on commit e4a8ab7

Please sign in to comment.