summaryrefslogtreecommitdiff
path: root/news/models.py
blob: 68d2865dedb73f99cbf3a222ea9d09bfb572c841 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from django.db import models
from django.contrib.auth.models import User
import re
from archweb_dev.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