diff options
author | bnewbold <bnewbold@robocracy.org> | 2010-10-25 19:40:32 +0000 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2010-10-25 19:41:52 +0000 |
commit | 1ad7cb33abfac55a9be2f1d889c369fd1b43df2f (patch) | |
tree | d8846689db0c2ddcc230ef33487c84b8e41ff18e /bn_django/photos | |
parent | bb7258b4be225ee072bf0002ce5f1a87446105ad (diff) | |
download | bnewnet-1ad7cb33abfac55a9be2f1d889c369fd1b43df2f.tar.gz bnewnet-1ad7cb33abfac55a9be2f1d889c369fd1b43df2f.zip |
changes for adelie
Diffstat (limited to 'bn_django/photos')
-rw-r--r-- | bn_django/photos/models.py | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/bn_django/photos/models.py b/bn_django/photos/models.py index dcef1fc..346e19d 100644 --- a/bn_django/photos/models.py +++ b/bn_django/photos/models.py @@ -14,12 +14,7 @@ try: except AttributeError: STOCKPHOTO_BASE='photos' -try: - STOCKPHOTO_URL = settings.STOCKPHOTO_URL -except AttributeError: - STOCKPHOTO_URL='/photos' -if STOCKPHOTO_URL[-1] == '/': - STOCKPHOTO_URL=STOCKPHOTO_URL[:-1] +STOCKPHOTO_URL='http://media.bnewbold.net/hosted-photos' try: ADMIN_URL = settings.ADMIN_URL @@ -59,7 +54,7 @@ class Gallery(models.Model): def __str__(self): return self.title def get_absolute_url(self): - return "%s/%s/" % (STOCKPHOTO_URL, self.slug) + return "%s/%s/" % (STOCKPHOTO_BASE, self.slug) def get_admin_url(self): return "%s/photos/gallery/%d/" % (ADMIN_URL, self.id) def was_published_today(self): @@ -121,7 +116,7 @@ class Photo(models.Model): #os.unlink(self.fullpath()) def get_absolute_url(self): - return "%s/detail/%d/" % (STOCKPHOTO_URL, self.id) + return "%s/detail/%d/" % (STOCKPHOTO_BASE, self.id) def get_admin_url(self): return "%s/photos/photos/%d/" % (ADMIN_URL, self.id) @@ -137,12 +132,7 @@ class Photo(models.Model): """URL to the thumbnail """ photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - if settings.MEDIA_URL.endswith('/'): - return settings.MEDIA_URL + STOCKPHOTO_BASE + \ - "/cache/thumbs/" + photobase - return settings.MEDIA_URL + '/' + STOCKPHOTO_BASE + \ - "/cache/thumbs/" + photobase - + return STOCKPHOTO_URL + "/cache/thumbs/" + photobase def disppath(self): photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] @@ -151,11 +141,7 @@ class Photo(models.Model): def dispurl(self): photobase = self.image.name[len(STOCKPHOTO_BASE)+1:] - if settings.MEDIA_URL.endswith('/'): - return settings.MEDIA_URL + STOCKPHOTO_BASE + "/cache/" \ - + photobase - return settings.MEDIA_URL + '/' + STOCKPHOTO_BASE + \ - "/cache/" + photobase + return STOCKPHOTO_URL + "/cache/" + photobase def fullpath(self): if self.image.name.startswith(os.path.sep): @@ -163,14 +149,7 @@ class Photo(models.Model): return os.path.join(settings.MEDIA_ROOT, self.image.name) def fullurl(self): - if self.image.name.startswith(os.path.sep): - # Shouldn't happen anymore - return (settings.MEDIA_URL + - self.image.name[len(settings.MEDIA_ROOT):]) - else: - if settings.MEDIA_URL.endswith('/'): - return settings.MEDIA_URL + self.image.name - return settings.MEDIA_URL + '/' + self.image.name + return STOCKPHOTO_URL + '/' + self.image.name def next(self): |