summaryrefslogtreecommitdiff
path: root/apps/projects
diff options
context:
space:
mode:
Diffstat (limited to 'apps/projects')
-rw-r--r--apps/projects/models/natparks.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/projects/models/natparks.py b/apps/projects/models/natparks.py
index fa0c84b..f4a739d 100644
--- a/apps/projects/models/natparks.py
+++ b/apps/projects/models/natparks.py
@@ -1,8 +1,10 @@
from django.contrib.gis.db import models
+from PIL import Image
from blog.models import Entry
from photos.models import PhotoGallery
from locations.models import State
+
PUB_STATUS = (
(0, 'Draft'),
(1, 'Published'),
@@ -35,6 +37,8 @@ class NationalParks(models.Model):
post = models.ForeignKey(Entry, null=True)
gallery = models.ForeignKey(PhotoGallery, blank=True, null=True, verbose_name='photo set')
image = models.FileField(upload_to=get_upload_path, null=True,blank=True,help_text="width: 980px, height: > 450px")
+ image_height = models.CharField(max_length=20, null=True,blank=True)
+ image_width = models.CharField(max_length=20, null=True,blank=True)
objects = models.GeoManager()
class Meta:
@@ -45,3 +49,8 @@ class NationalParks(models.Model):
def __unicode__(self):
return self.unit_name
+ def save(self):
+ #get image dimensions
+ img = Image.open(self.image)
+ self.image_width, self.image_height = img.size
+ super(NationalParks, self).save() \ No newline at end of file