Created
November 27, 2014 14:03
-
-
Save danielbraun/87384ea330053b3ffa83 to your computer and use it in GitHub Desktop.
Django Rest Framework + ImageField URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When serializing models using DRF, the related ImageFields return the file system path instead of an absolute URL. | |
To solve it, define an instance variable on your model serializer: | |
class PersonSerializer(serializers.ModelSerializer): | |
image = serializers.Field('image.url') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment