summaryrefslogtreecommitdiff
path: root/app/jrnl/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/jrnl/models.py')
-rw-r--r--app/jrnl/models.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index 8e86c62..5c2a11d 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -8,6 +8,7 @@ from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sitemaps import Sitemap
from django import forms
+from django.template.defaultfilters import slugify
# http://freewisdom.org/projects/python-markdown/
import markdown
@@ -168,6 +169,32 @@ class Entry(models.Model):
super(Entry, self).save()
+class EntryTitleSong(models.Model):
+ title = models.CharField(max_length=200)
+ band = models.CharField(max_length=200)
+ album = models.CharField(max_length=200, blank=True, null=True)
+ song = models.CharField(max_length=200, blank=True, null=True)
+ listen_link = models.CharField(max_length=200, blank=True, null=True)
+ entry = models.ForeignKey(Entry)
+ slug = models.SlugField(unique_for_date='pub_date', blank=True)
+ body_markdown = models.TextField(blank=True)
+ body_html = models.TextField(blank=True)
+ pub_date = models.DateField('Date published')
+
+ class Meta:
+ ordering = ('-pub_date',)
+ get_latest_by = 'pub_date'
+ verbose_name_plural = 'Entry Title Songs'
+
+ def __str__(self):
+ return self.title
+
+ def save(self):
+ if not self.id and not self.pub_date:
+ self.pub_date = datetime.datetime.now()
+ self.slug = slugify(self.title)
+
+
class EntryAside(models.Model):
title = models.CharField(max_length=200)
body = models.TextField(null=True, blank=True)