2008-08-12 04:49:19 +08:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2008-08-12 04:49:19 +08:00
|
|
|
class Entry(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
2013-07-18 03:20:20 +08:00
|
|
|
updated = models.DateTimeField()
|
|
|
|
published = models.DateTimeField()
|
2010-01-28 21:46:18 +08:00
|
|
|
|
|
|
|
class Meta:
|
2013-07-18 03:20:20 +08:00
|
|
|
ordering = ('updated',)
|
2010-01-28 21:46:18 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2010-01-28 21:46:18 +08:00
|
|
|
return self.title
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
return "/blog/%s/" % self.pk
|
|
|
|
|
|
|
|
|
|
|
|
class Article(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
2015-07-22 22:43:21 +08:00
|
|
|
entry = models.ForeignKey(Entry, models.CASCADE)
|
2020-10-13 09:53:49 +08:00
|
|
|
updated = models.DateTimeField()
|
|
|
|
published = models.DateTimeField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ['updated']
|