[Django]-Django_countries in django rest framework

4👍

You can user serializer_fields in django_countries.

Like This:

from django_countries.serializer_fields import CountryField

class PersonSerializer(serializers.ModelSerializer):
    country = CountryField()

    class Meta:
        model = models.Person
        fields = ('name', 'email', 'country')

Leave a comment