handle url_prefix
This commit is contained in:
parent
f257da3567
commit
bf9b95f2e6
1 changed files with 2 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue