summaryrefslogtreecommitdiff
path: root/sublab_project/news
diff options
context:
space:
mode:
Diffstat (limited to 'sublab_project/news')
-rw-r--r--sublab_project/news/models.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/sublab_project/news/models.py b/sublab_project/news/models.py
index b1a0acc..d1a4c69 100644
--- a/sublab_project/news/models.py
+++ b/sublab_project/news/models.py
@@ -10,15 +10,21 @@ from utils import render_creole
class News(models.Model):
"""A news item.
"""
- title = models.CharField(max_length=255)
- slug = models.SlugField(unique=True)
- content = models.TextField()
+ title = models.CharField('Titel', max_length=255)
+ slug = models.SlugField('Slug', unique=True)
+ content = models.TextField('Inhalt',
+ help_text='Es kann Creole als Markup benutzt werden.')
content_html = models.TextField(editable=False)
projects = models.ManyToManyField(Project, blank=True,
- related_name='news')
- author = models.ForeignKey(User, editable=False)
- date_created = models.DateTimeField(editable=False)
- date_updated = models.DateTimeField(editable=False)
+ related_name='news', verbose_name='Projekte')
+ author = models.ForeignKey(User, editable=False, verbose_name='Autor')
+ date_created = models.DateTimeField('Erstellungsdatum', editable=False)
+ date_updated = models.DateTimeField('Aktualisierungsdatum', editable=False)
+
+ class Meta:
+ ordering = ['date_updated']
+ verbose_name = 'News'
+ verbose_name_plural = 'News'
def __unicode__(self):
return self.title
@@ -29,3 +35,7 @@ class News(models.Model):
self.date_updated = datetime.datetime.now()
self.content_html = render_creole(self.content)
super(News, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('news_detail', (), {'id': self.id})