handle url_prefix

This commit is contained in:
j 2022-04-22 18:23:21 +01:00
parent f257da3567
commit bf9b95f2e6

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.db import models
from django.urls import reverse
@ -9,7 +10,7 @@ class Image(models.Model):
file = models.ImageField(upload_to='image', null=True, blank=True)
def get_absolute_url(self):
return self.file.url
return '/' + settings.URL_PREFIX + self.file.url[1:]
get_absolute_url.short_description = 'URL'
def image_tag(self):