Skip to content

Instantly share code, notes, and snippets.

@danielbraun
Created November 27, 2014 14:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danielbraun/87384ea330053b3ffa83 to your computer and use it in GitHub Desktop.
Save danielbraun/87384ea330053b3ffa83 to your computer and use it in GitHub Desktop.
Django Rest Framework + ImageField URL
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