-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple objects returned while serializing using cities__name_std #126
Comments
You will need to use the slug field for this - that's what it's there for after all! location = serializers.SlugRelatedField(slug_field='slug', queryset=City.objects.all()) Keep in mind that you will need to fill in that field yourself, but... I've got some changes I need to push, and one of them is creating a unique constraint on the |
Hey @blag thanks for the information and help! Let me know if I can help you with anything. |
I just pushed version 0.5 to PyPI, so you should be able to upgrade using pip: pip install --upgrade django-cities That version adds slugs to models, and allows you to specify your own Since all of the building blocks are in place, and the default settings should handle this (or at least handle 90% of it), I'm closing this issue. Feel free to reopen it if you run into any issues. Cheers! |
I am having a
Any suggestion ? |
I have serializer like this:
`class ExperienceSerializer(serializers.ModelSerializer):
`
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?
The text was updated successfully, but these errors were encountered: