summaryrefslogtreecommitdiff
path: root/news/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'news/models.py')
-rw-r--r--news/models.py19
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