diff options
Diffstat (limited to 'app/projects')
-rw-r--r-- | app/projects/models/base.py | 9 | ||||
-rw-r--r-- | app/projects/models/natparks.py | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/projects/models/base.py b/app/projects/models/base.py index 51379a0..f0cd6d0 100644 --- a/app/projects/models/base.py +++ b/app/projects/models/base.py @@ -1,6 +1,7 @@ import datetime from django.contrib.gis.db import models from django.contrib.sitemaps import Sitemap +from django.conf import settings import markdown @@ -37,12 +38,17 @@ class Project(models.Model): '''Get the site's latitude.''' return self.point.y + @property + def get_project_image(self): + return "%s%s" % (settings.IMAGES_URL, self.image.name[7:]) + + class Meta: ordering = ('-pub_date',) get_latest_by = 'pub_date' app_label = 'projects' - def __unicode__(self): + def __str__(self): return self.title def get_absolute_url(self): @@ -58,6 +64,7 @@ class Project(models.Model): class ProjectSitemap(Sitemap): changefreq = "monthly" priority = 0.5 + protocol = "https" def items(self): return Project.objects.filter(status=1) diff --git a/app/projects/models/natparks.py b/app/projects/models/natparks.py index 3615737..2eee677 100644 --- a/app/projects/models/natparks.py +++ b/app/projects/models/natparks.py @@ -1,6 +1,7 @@ import datetime from PIL import Image from django.contrib.gis.db import models +from django.conf import settings from blog.models import Entry from photos.models import PhotoGallery from locations.models import State @@ -44,6 +45,10 @@ class NationalParks(models.Model): def __str__(self): return self.unit_name + @property + def get_image_url(self): + return "%s%s" % (settings.IMAGES_URL, self.image.name[7:]) + def save(self): #get image dimensions img = Image.open(self.image) |