Skip to content

Instantly share code, notes, and snippets.

@danielbraun
Created November 27, 2014 14:03
Show Gist options
  • 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