1 from django
.db
import models
2 from django
.contrib
.auth
.models
import User
4 from archweb_dev
.utils
import Stripper
6 class News(models
.Model
):
7 id = models
.AutoField(primary_key
=True)
8 author
= models
.ForeignKey(User
)
9 postdate
= models
.DateField(auto_now_add
=True)
10 title
= models
.CharField(maxlength
=255)
11 content
= models
.TextField()
14 verbose_name_plural
= 'news'
15 get_latest_by
= 'postdate'
16 ordering
= ['-postdate', '-id']
18 def get_absolute_url(self
):
19 return '/news/%i/' % self
.id