diff options
author | eliott <eliott@cactuswax.net> | 2007-11-03 03:45:10 -0400 |
---|---|---|
committer | eliott <eliott@cactuswax.net> | 2007-11-03 03:45:10 -0400 |
commit | 39a548fd2629f3b6383990264b2e331b3aea99fb (patch) | |
tree | f68c3156dad5f7814473ceff2461679ddf11a2e8 /news/models.py |
Initial import for public release...
Special Note
Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
Diffstat (limited to 'news/models.py')
-rw-r--r-- | news/models.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/news/models.py b/news/models.py new file mode 100644 index 00000000..acd9667c --- /dev/null +++ b/news/models.py @@ -0,0 +1,19 @@ +from django.db import models +from django.contrib.auth.models import User +import re +from archlinux.utils import Stripper + +class News(models.Model): + id = models.AutoField(primary_key=True) + author = models.ForeignKey(User) + postdate = models.DateField(auto_now_add=True) + title = models.CharField(maxlength=255) + content = models.TextField() + class Meta: + db_table = 'news' + verbose_name_plural = 'news' + get_latest_by = 'postdate' + ordering = ['-postdate', '-id'] + + def get_absolute_url(self): + return '/news/%i/' % self.id |