Skip to content

Multiple objects returned while serializing using cities__name_std #126

@kishan3

Description

@kishan3

I have serializer like this:
`class ExperienceSerializer(serializers.ModelSerializer):

    experience_type = ChoicesField(choices=Experience.EXPERIENCE_TYPE)
    location = serializers.SlugRelatedField(slug_field='name_std', queryset=City.objects.all())

`

Whenever I enter "Delhi" as location It fails with "get() returned more than one City -- it returned 2!"
There are cities with same name so how to hanle this scenario?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions