diff options
author | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2011-12-30 00:38:42 +0100 |
---|---|---|
committer | Markus Zapke-Grùˆndemann <info@keimlink.de> | 2011-12-30 00:38:42 +0100 |
commit | 0edd939a90b15d4d7c722df23231f18f21e1e127 (patch) | |
tree | 7cb5d5c5c2858abf6906c451bd7a4ebbaa5f96a1 /sublab_project/news | |
parent | b3640fa3adde479142a5d275213ae24037329ad9 (diff) |
Added field names and get_absolute_url method.
Diffstat (limited to 'sublab_project/news')
-rw-r--r-- | sublab_project/news/models.py | 24 |
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}) |