don't hardcode media url in attachments
This commit is contained in:
parent
dafa5ca517
commit
3c2da5f25b
@ -1,5 +1,6 @@
|
|||||||
from django.db import models
|
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import models
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from . import util
|
from . import util
|
||||||
@ -24,10 +25,10 @@ class Attachment(models.Model):
|
|||||||
return '{}.{}'.format(self.filehash, ext)
|
return '{}.{}'.format(self.filehash, ext)
|
||||||
|
|
||||||
def thumb(self):
|
def thumb(self):
|
||||||
return '/media/thumb-{}.jpg'.format(self.path())
|
return '{}thumb-{}.jpg'.format(settings.MEDIA_URL, self.path())
|
||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
return '/media/{}'.format(self.path())
|
return '{}{}'.format(settings.MEDIA_URL, self.path())
|
||||||
|
|
||||||
|
|
||||||
class Newsgroup(models.Model):
|
class Newsgroup(models.Model):
|
||||||
|
Reference in New Issue
Block a user