summaryrefslogtreecommitdiff
path: root/bak/unused_apps/trips/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/trips/models.py
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/trips/models.py')
-rw-r--r--bak/unused_apps/trips/models.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bak/unused_apps/trips/models.py b/bak/unused_apps/trips/models.py
new file mode 100644
index 0000000..76941f2
--- /dev/null
+++ b/bak/unused_apps/trips/models.py
@@ -0,0 +1,40 @@
+import json
+import requests
+from django import forms
+from django.urls import reverse
+from django.apps import apps
+from django.contrib.gis.geos import GEOSGeometry, fromstr, MultiPolygon
+from django.contrib.gis.db import models
+from django.contrib.sitemaps import Sitemap
+from django.utils.safestring import mark_safe
+from django.utils import timezone
+from django.conf import settings
+
+from utils.util import render_images, extract_main_image, markdown_to_html
+from locations.models import Route
+
+
+class Trip(models.Model):
+ """Model to define trips"""
+ title = models.CharField(max_length=50)
+ subtitle = models.CharField(max_length=200, blank=True)
+ slug = models.SlugField(unique_for_date='pub_date')
+ dek_markdown = models.TextField()
+ dek_html = models.TextField(null=True, blank=True)
+ pub_date = models.DateTimeField('Date published')
+ start_date = models.DateTimeField('Date started')
+ end_date = models.DateTimeField('Date ended')
+ route = models.ForeignKey(Route, on_delete=models.CASCADE)
+
+ def get_absolute_url(self):
+ return "/trips/%s/" % (self.slug)
+
+ def __str__(self):
+ return self.title
+
+ def save(self, *args, **kwargs):
+ created = self.pk is None
+ if not created:
+ md = render_images(self.dek_markdown)
+ self.dek_html = markdown_to_html(md)
+ super(Trip, self).save(*args, **kwargs)