From efb623af0bcb47d510501c282e1326b11343a29c Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 22 Sep 2012 22:27:04 -0400 Subject: site reorg --- apps/projects/models/__init__.py | 4 --- apps/projects/models/base.py | 75 ---------------------------------------- apps/projects/models/code.py | 25 -------------- apps/projects/models/fiveby.py | 58 ------------------------------- apps/projects/models/natparks.py | 56 ------------------------------ 5 files changed, 218 deletions(-) delete mode 100644 apps/projects/models/__init__.py delete mode 100644 apps/projects/models/base.py delete mode 100644 apps/projects/models/code.py delete mode 100644 apps/projects/models/fiveby.py delete mode 100644 apps/projects/models/natparks.py (limited to 'apps/projects/models') diff --git a/apps/projects/models/__init__.py b/apps/projects/models/__init__.py deleted file mode 100644 index 7fe6077..0000000 --- a/apps/projects/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from base import Project -from fiveby import FiveBy -from natparks import NationalParks -from code import Code \ No newline at end of file diff --git a/apps/projects/models/base.py b/apps/projects/models/base.py deleted file mode 100644 index debb776..0000000 --- a/apps/projects/models/base.py +++ /dev/null @@ -1,75 +0,0 @@ -import datetime -from django.contrib.gis.db import models -from django.conf import settings -from django.contrib.syndication.feeds import Feed -from django.contrib.sitemaps import Sitemap -from django.template.defaultfilters import truncatewords_html - - -from utils import markdown2 as markdown - - -from photos.models import PhotoGallery -from locations.models import Location,Region - - -def get_upload_path(self, filename): - return "images/project-thumbs/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename) - -def markdown_processor(md): - html = markdown.markdown(md, safe_mode = False).split('') - return html - - - -class Project(models.Model): - title = models.CharField(max_length=200) - subtitle = models.CharField(max_length=200, null=True, blank=True) - slug = models.SlugField(unique_for_date='pub_date') - lede = models.TextField(blank=True) - pub_date = models.DateTimeField('Date published') - PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), - ) - status = models.IntegerField(choices=PUB_STATUS, default=0) - image = models.FileField(upload_to=get_upload_path, null=True,blank=True) - model_name = models.CharField(max_length=200, null=True) - - @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 - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - app_label = 'projects' - - def __unicode__(self): - return self.title - - def get_absolute_url(self): - return "/%s/%s/" % ('projects', self.slug) - - def get_previous_published(self): - return self.get_previous_by_pub_date(status__exact=1) - - def get_next_published(self): - return self.get_next_by_pub_date(status__exact=1) - - -class ProjectSitemap(Sitemap): - changefreq = "monthly" - priority = 0.5 - - def items(self): - return Project.objects.filter(status=1) - - def lastmod(self, obj): - return obj.pub_date diff --git a/apps/projects/models/code.py b/apps/projects/models/code.py deleted file mode 100644 index 14a66f0..0000000 --- a/apps/projects/models/code.py +++ /dev/null @@ -1,25 +0,0 @@ -from django.db import models - - -PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), - ) - - - -class Code(models.Model): - name = models.CharField(max_length=254) - slug = models.SlugField() - date_created = models.DateField('Date Created') - status = models.IntegerField(choices=PUB_STATUS, default=0) - body_html = models.TextField(blank=True) - - class Meta: - verbose_name_plural = "Code" - app_label = 'projects' - ordering = ('-date_created',) - # Returns the string representation of the model. - def __unicode__(self): - return self.slug - diff --git a/apps/projects/models/fiveby.py b/apps/projects/models/fiveby.py deleted file mode 100644 index 5415ee7..0000000 --- a/apps/projects/models/fiveby.py +++ /dev/null @@ -1,58 +0,0 @@ -import datetime -from django.contrib.gis.db import models -from django.conf import settings -from django.contrib.syndication.feeds import Feed -from django.contrib.sitemaps import Sitemap -from django.template.defaultfilters import truncatewords_html - -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 - \ No newline at end of file diff --git a/apps/projects/models/natparks.py b/apps/projects/models/natparks.py deleted file mode 100644 index f4a739d..0000000 --- a/apps/projects/models/natparks.py +++ /dev/null @@ -1,56 +0,0 @@ -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'), - ) - - -import datetime -def get_upload_path(self, filename): - return "images/projects/np/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename) - - -class NationalParks(models.Model): - type = models.CharField(max_length=50) - name = models.CharField(max_length=254) - state = models.ForeignKey(State, null=True) - size = models.CharField(max_length=10, null=True) - fee = models.CharField(max_length=5, null=True) - camping_fee = models.CharField(max_length=10, null=True) - url = models.CharField(max_length=250, null=True) - code= models.CharField(max_length=16) - unit_name= models.CharField(max_length=254) - date_visited_begin = models.DateField('Date Visited',null=True) - date_visited_end = models.DateField('Date Visited',null=True) - date_park_created = models.DateField('Date Park Created',null=True) - zoom= models.IntegerField(null=True) - mpoly = models.MultiPolygonField(null=True) - visited = models.BooleanField(default=False) - dek = models.TextField(null=True, blank=True) - tag_line = models.CharField(max_length=254, null=True) - 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: - verbose_name_plural = "National Parks" - app_label = 'projects' - ordering = ('-visited','unit_name',) - # Returns the string representation of the 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 -- cgit v1.2.3-70-g09d2