From 61cbcea237a2c69bbaa3595050536ec10bed2b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Zapke-Gru=CC=88ndemann?= Date: Thu, 29 Dec 2011 21:33:14 +0100 Subject: Initial commit. --- sublab_project/projects/models.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 sublab_project/projects/models.py (limited to 'sublab_project/projects/models.py') diff --git a/sublab_project/projects/models.py b/sublab_project/projects/models.py new file mode 100644 index 0000000..f164956 --- /dev/null +++ b/sublab_project/projects/models.py @@ -0,0 +1,27 @@ +import datetime + +from django.contrib.auth.models import User +from django.db import models + + +class Project(models.Model): + """A project. + """ + name = models.CharField(max_length=100) + slug = models.SlugField(unique=True) + description = models.TextField() + 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) + + def __unicode__(self): + return self.name + + def save(self, *args, **kwargs): + if not self.id: + self.date_created = datetime.datetime.now() + self.date_updated = datetime.datetime.now() + return super(Project, self).save(*args, **kwargs) -- cgit v1.2.1