summaryrefslogtreecommitdiff
path: root/sublab_project
diff options
context:
space:
mode:
authorMarkus Zapke-Grùˆndemann <info@keimlink.de>2011-12-30 00:38:42 +0100
committerMarkus Zapke-Grùˆndemann <info@keimlink.de>2011-12-30 00:38:42 +0100
commit0edd939a90b15d4d7c722df23231f18f21e1e127 (patch)
tree7cb5d5c5c2858abf6906c451bd7a4ebbaa5f96a1 /sublab_project
parentb3640fa3adde479142a5d275213ae24037329ad9 (diff)
Added field names and get_absolute_url method.
Diffstat (limited to 'sublab_project')
-rw-r--r--sublab_project/news/models.py24
-rw-r--r--sublab_project/projects/models.py25
2 files changed, 34 insertions, 15 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})
diff --git a/sublab_project/projects/models.py b/sublab_project/projects/models.py
index b343f98..0687216 100644
--- a/sublab_project/projects/models.py
+++ b/sublab_project/projects/models.py
@@ -9,15 +9,20 @@ from utils import render_creole
class Project(models.Model):
"""A project.
"""
- name = models.CharField(max_length=100)
- slug = models.SlugField(unique=True)
- description = models.TextField()
+ name = models.CharField('Name', max_length=100)
+ slug = models.SlugField('Slug', unique=True)
+ description = models.TextField('Beschreibung')
description_html = models.TextField(editable=False)
- contact_email = models.EmailField(blank=True)
- contact_url = models.URLField(blank=True)
- contact_user = models.ForeignKey(User)
- date_created = models.DateTimeField(editable=False)
- date_updated = models.DateTimeField(editable=False)
+ contact_email = models.EmailField('E-Mail', blank=True)
+ contact_url = models.URLField('URL', blank=True)
+ contact_user = models.ForeignKey(User, verbose_name='Ansprechpartner')
+ date_created = models.DateTimeField('Erstellungsdatum', editable=False)
+ date_updated = models.DateTimeField('Aktualisierungsdatum', editable=False)
+
+ class Meta:
+ ordering = ['name']
+ verbose_name = 'Projekt'
+ verbose_name_plural = 'Projekte'
def __unicode__(self):
return self.name
@@ -28,3 +33,7 @@ class Project(models.Model):
self.date_updated = datetime.datetime.now()
self.description_html = render_creole(self.description)
return super(Project, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('projects_detail', (), {'id': self.id})