aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/journal/models.py
diff options
context:
space:
mode:
authorbnewbold <bnewbold@eta.mit.edu>2009-02-01 06:25:10 -0500
committerbnewbold <bnewbold@eta.mit.edu>2009-02-01 06:25:10 -0500
commitc7b29da94d3b85ec91f0d5e2789db11a43473df5 (patch)
treea5502674da4a9ed8367f911112d34c094481e83c /bn_django/journal/models.py
parent0988ee83c8a8b24801624beae78ceba1bfa82d07 (diff)
downloadbnewnet-c7b29da94d3b85ec91f0d5e2789db11a43473df5.tar.gz
bnewnet-c7b29da94d3b85ec91f0d5e2789db11a43473df5.zip
lots went on:
* rss feeds * some admin interface stuff * blah running issues: * admin interface with model inheretence? * rss feeds: unicode cool? * proper year/month implementation (don't want day) * right side bar info * dating issue (datetime vs date)
Diffstat (limited to 'bn_django/journal/models.py')
-rw-r--r--bn_django/journal/models.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/bn_django/journal/models.py b/bn_django/journal/models.py
index d296f1f..20107c9 100644
--- a/bn_django/journal/models.py
+++ b/bn_django/journal/models.py
@@ -10,6 +10,9 @@ class SubJournal(models.Model):
slug = models.SlugField()
description = models.TextField("description of content",blank=True)
+ def __unicode__(self):
+ return self.name
+
class Meta:
get_latest_by = 'date'
ordering = ['-date']
@@ -17,7 +20,7 @@ class SubJournal(models.Model):
class JournalCommon(models.Model):
author = User("User who created this")
date = models.DateTimeField("associated day", auto_now=True)
- last_edited = models.DateField("day last edited", auto_now_add=True)
+ last_edited = models.DateTimeField("day last edited", auto_now_add=True)
subjournal = models.ForeignKey(SubJournal,blank=True,null=True)
defunct = models.BooleanField("is this entry all around done with?",default=False,blank=False)
private = models.BooleanField("is this entry for validated users only?",default=False,blank=False)
@@ -32,13 +35,24 @@ class Entry(JournalCommon):
title = models.CharField("entry title", max_length=384)
slug = models.SlugField()
+ def __unicode__(self):
+ return self.title
+
def get_absolute_url(self):
- return "/journal/%s/"%self.slug
+ #return "/journal/entries/%04d/%02d/%02d/%s/"%(self.date.year, self.date.month, self.date.day, self.slug)
+ return "/journal/entries/%s/"%self.slug
class MicroEntry(JournalCommon):
html_content = models.TextField("html format content", blank=False)
text_content = models.TextField("text version of content", blank=True,null=True)
+ def __unicode__(self):
+ self.text_content[:50]
+
+ def get_absolute_url(self):
+ return "/journal/microentries/%s/"%self.id
+ #return "/journal/microentries/%04d/%02d/%02d/%s/"%(self.date.year, self.date.month, self.date.day, self.slug)
+
class Artifact(JournalCommon):
html_caption = models.TextField("html format caption", blank=True)
text_caption = models.TextField("text format caption", blank=True)
@@ -61,6 +75,12 @@ class CodeArtifact(Artifact):
class LinkArtifact(Artifact):
url = models.URLField("external link to something wonderful!",verify_exists=False)
+ def __unicode__(self):
+ return self.title
+
+ def get_absolute_url(self):
+ return "/artifacts/links/%s/"% self.id
+
class ImageArtifact(Artifact,Photo):
"""Multiply inherets from the photo app
"""
@@ -76,13 +96,3 @@ def delete_thumbnails(sender, instance, signal, *args, **kwargs):
signals.post_save.connect(build_display_images, sender=ImageArtifact)
signals.pre_delete.connect(delete_thumbnails, sender=ImageArtifact)
-
-from django.contrib import admin
-
-admin.site.register(Entry)
-admin.site.register(MicroEntry)
-admin.site.register(SubJournal)
-admin.site.register(LinkArtifact)
-admin.site.register(CodeArtifact)
-admin.site.register(VideoArtifact)
-admin.site.register(ImageArtifact)