diff options
author | luxagraf <sng@luxagraf.net> | 2012-09-22 22:27:04 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2012-09-22 22:27:04 -0400 |
commit | efb623af0bcb47d510501c282e1326b11343a29c (patch) | |
tree | 3a35fb19f5eba3b219c65277a5fb712cbe9604ac /app/projects/models/fiveby.py | |
parent | 0b481fd7931c2ae20ca21f89a87f2ba6a6c01e10 (diff) |
site reorg
Diffstat (limited to 'app/projects/models/fiveby.py')
-rw-r--r-- | app/projects/models/fiveby.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/app/projects/models/fiveby.py b/app/projects/models/fiveby.py new file mode 100644 index 0000000..45aa21d --- /dev/null +++ b/app/projects/models/fiveby.py @@ -0,0 +1,58 @@ +import datetime +from django.contrib.gis.db import models +from django.conf import settings +from django.contrib.sitemaps import Sitemap +from django.template.defaultfilters import truncatewords_html +from django.contrib.syndication.views import Feed + +from locations.models import Location,Region + +def get_upload_path(self, filename): + return "images/projects/videos/5x5/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename) + +def get_image_upload_path(self, filename): + return "images/projects/5x5/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename) + +class FiveBy(models.Model): + title = models.CharField(max_length=200) + slug = models.SlugField(unique_for_date='pub_date') + lede = models.TextField(blank=True) + image = models.FileField(upload_to=get_image_upload_path, null=True,blank=True) + videoh264 = models.FileField(upload_to=get_upload_path, null=True,blank=True) + videoogg = models.FileField(upload_to=get_upload_path, null=True,blank=True) + vimeo_link = models.CharField(max_length=200) + youtube_link = models.CharField(max_length=200) + pub_date = models.DateTimeField('Date published') + PUB_STATUS = ( + (0, 'Draft'), + (1, 'Published'), + ) + status = models.IntegerField(choices=PUB_STATUS, default=0) + point = models.PointField(null=True) + location = models.ForeignKey(Location, null=True) + region = models.ForeignKey(Region, null=True) + + + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + app_label = 'projects' + verbose_name_plural = '5x5' + + def __unicode__(self): + return self.title + + def get_absolute_url(self): + return "/%s/%s/%s/" % ('projects', '5x5', self.slug) + + @property + def longitude(self): + '''Get the site's longitude.''' + return self.point.x + + @property + def latitude(self): + '''Get the site's latitude.''' + return self.point.y + |