Skip to content
Advertisement

Tag: filefield

Django REST Framework and FileField absolute url

I’ve defined a simple Django app that includes the following model: (Technically yes, that could have been an ImageField.) In a template, it’s easy enough to include the MEDIA_URL value (duly coded in settings.py) as a prefix to the thumbnail URL. The following works fine: Using DRF, I’ve defined a HyperlinkedModelSerializer descendant called ProjectSerializer: And I’ve defined a very straightforward

Advertisement