Archived
1
0

don't hardcode media url in attachments

This commit is contained in:
Jeff Becker 2016-11-06 11:21:37 -05:00
parent dafa5ca517
commit 3c2da5f25b
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B

View File

@ -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 . import util
@ -24,10 +25,10 @@ class Attachment(models.Model):
return '{}.{}'.format(self.filehash, ext)
def thumb(self):
return '/media/thumb-{}.jpg'.format(self.path())
return '{}thumb-{}.jpg'.format(settings.MEDIA_URL, self.path())
def source(self):
return '/media/{}'.format(self.path())
return '{}{}'.format(settings.MEDIA_URL, self.path())
class Newsgroup(models.Model):