2008-08-12 04:49:19 +08:00
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2008-08-12 04:49:19 +08:00
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
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
|
|
|
|
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2010-01-28 21:46:18 +08:00
|
|
|
class Article(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
|
|
|
entry = models.ForeignKey(Entry)
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2010-01-28 21:46:18 +08:00
|
|
|
return self.title
|