diff options
author | luxagraf <sng@luxagraf.net> | 2020-12-02 15:02:12 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-12-02 15:02:12 -0500 |
commit | ab8055b5cab2523d925f59c65bc38df103a26991 (patch) | |
tree | 29e4597bc0d86d658f574c0c4f0b036351a68742 /app/unused_apps/projects/models | |
parent | 87f692178a6e30719c564076f00c206642f36ce6 (diff) |
deleted old apps and media
Diffstat (limited to 'app/unused_apps/projects/models')
-rw-r--r-- | app/unused_apps/projects/models/__init__.py | 5 | ||||
-rw-r--r-- | app/unused_apps/projects/models/base.py | 67 | ||||
-rw-r--r-- | app/unused_apps/projects/models/fiveby.py | 53 | ||||
-rw-r--r-- | app/unused_apps/projects/models/gifs.py | 26 | ||||
-rw-r--r-- | app/unused_apps/projects/models/natparks.py | 55 | ||||
-rw-r--r-- | app/unused_apps/projects/models/self_experiments.py | 56 |
6 files changed, 0 insertions, 262 deletions
diff --git a/app/unused_apps/projects/models/__init__.py b/app/unused_apps/projects/models/__init__.py deleted file mode 100644 index 3230ff4..0000000 --- a/app/unused_apps/projects/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .base import Project -from .fiveby import FiveBy -from .natparks import NationalParks -from .gifs import AnimatedGif -from .self_experiments import Experiment diff --git a/app/unused_apps/projects/models/base.py b/app/unused_apps/projects/models/base.py deleted file mode 100644 index aa795d2..0000000 --- a/app/unused_apps/projects/models/base.py +++ /dev/null @@ -1,67 +0,0 @@ -import datetime -from django.contrib.gis.db import models -from django.contrib.sitemaps import Sitemap -from django.conf import settings - - -def get_upload_path(self, filename): - return "images/project-thumbs/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename) - - -class Project(models.Model): - title = models.CharField(max_length=200) - subtitle = models.CharField(max_length=200, null=True, blank=True) - slug = models.CharField(max_length=50) - 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 - - @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 __str__(self): - return self.title - - def get_absolute_url(self): - return "/%s/" % (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 - protocol = "https" - - def items(self): - return Project.objects.filter(status=1) - - def lastmod(self, obj): - return obj.pub_date diff --git a/app/unused_apps/projects/models/fiveby.py b/app/unused_apps/projects/models/fiveby.py deleted file mode 100644 index 473c095..0000000 --- a/app/unused_apps/projects/models/fiveby.py +++ /dev/null @@ -1,53 +0,0 @@ -import datetime -from django.contrib.gis.db import models -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, on_delete=models.CASCADE, null=True) - region = models.ForeignKey(Region, on_delete=models.CASCADE, null=True) - - class Meta: - ordering = ('-pub_date',) - get_latest_by = 'pub_date' - app_label = 'projects' - verbose_name_plural = '5x5' - - def __str__(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 diff --git a/app/unused_apps/projects/models/gifs.py b/app/unused_apps/projects/models/gifs.py deleted file mode 100644 index 25b8734..0000000 --- a/app/unused_apps/projects/models/gifs.py +++ /dev/null @@ -1,26 +0,0 @@ -import datetime -from django.db import models - - -def get_upload_path(self, filename): - return "images/projects/gifs/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename) - - -class AnimatedGif(models.Model): - title = models.CharField(max_length=254) - gif = models.ImageField(upload_to=get_upload_path) - slug = models.SlugField() - date_created = models.DateField('Date Created') - music_ogg = models.FileField(upload_to=get_upload_path, blank=True, null=True) - music_mp3 = models.FileField(upload_to=get_upload_path, blank=True, null=True) - - class Meta: - verbose_name_plural = "Animated Gifs" - app_label = 'projects' - ordering = ('-date_created',) - - def __str__(self): - return self.slug - - def get_absolute_url(self): - return '/projects/gifs/%s/' % (self.slug) diff --git a/app/unused_apps/projects/models/natparks.py b/app/unused_apps/projects/models/natparks.py deleted file mode 100644 index 980d9fa..0000000 --- a/app/unused_apps/projects/models/natparks.py +++ /dev/null @@ -1,55 +0,0 @@ -import datetime -from PIL import Image -from django.contrib.gis.db import models -from django.conf import settings -from jrnl.models import Entry -from photos.models import PhotoGallery -from locations.models import State - - -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, on_delete=models.CASCADE, 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, on_delete=models.CASCADE, null=True) - gallery = models.ForeignKey(PhotoGallery, on_delete=models.CASCADE, 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) - - class Meta: - verbose_name_plural = "National Parks" - app_label = 'projects' - ordering = ('-visited', 'unit_name',) - - 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) - self.image_width, self.image_height = img.size - super(NationalParks, self).save() diff --git a/app/unused_apps/projects/models/self_experiments.py b/app/unused_apps/projects/models/self_experiments.py deleted file mode 100644 index be9d0b7..0000000 --- a/app/unused_apps/projects/models/self_experiments.py +++ /dev/null @@ -1,56 +0,0 @@ -import datetime -from django.db import models - -import markdown - -PUB_STATUS = ( - (0, 'Draft'), - (1, 'Published'), -) - - -def markdown_processor(md): - return markdown.markdown(md, ['footnotes'], safe_mode=False) - - -class Experiment(models.Model): - title = models.CharField(max_length=254) - slug = models.SlugField() - date_created = models.DateField(auto_now_add=True) - date_start = models.DateField() - date_end_actual = models.DateField(blank=True, null=True) - date_end_projected = models.DateField(blank=True) - duration = models.PositiveSmallIntegerField(default=30) - status = models.IntegerField(choices=PUB_STATUS, default=0) - body_html = models.TextField(blank=True) - body_markdown = models.TextField() - - class Meta: - app_label = 'projects' - ordering = ('-date_start',) - - # Returns the string representation of the model. - def __str__(self): - return self.title - - def get_absolute_url(self): - return "/projects/experiments/%s/%s/" % (self.pub_date.strftime("%Y").lower(), self.slug) - - def days_remaining(self): - return self.date_end_projected - datetime.date.today() - - @property - def get_previous_published(self): - return self.get_previous_by_pub_date(status__exact=1) - - @property - def get_next_published(self): - return self.get_next_by_pub_date(status__exact=1) - - def comment_period_open(self): - return self.enable_comments and datetime.datetime.today() - datetime.timedelta(30) <= self.pub_date - - def save(self): - self.body_html = markdown_processor(self.body_markdown) - self.date_end_projected = self.date_start + datetime.timedelta(self.duration) - super(Experiment, self).save() |