2008-08-11 20:49:19 +00:00
|
|
|
from django.db import models
|
2012-08-12 10:32:08 +00:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2008-08-11 20:49:19 +00:00
|
|
|
|
2011-10-13 21:34:56 +00:00
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
@python_2_unicode_compatible
|
2008-08-11 20:49:19 +00:00
|
|
|
class Entry(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
2013-07-17 19:20:20 +00:00
|
|
|
updated = models.DateTimeField()
|
|
|
|
published = models.DateTimeField()
|
2010-01-28 13:46:18 +00:00
|
|
|
|
|
|
|
class Meta:
|
2013-07-17 19:20:20 +00:00
|
|
|
ordering = ('updated',)
|
2010-01-28 13:46:18 +00:00
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2010-01-28 13:46:18 +00:00
|
|
|
return self.title
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
|
|
|
return "/blog/%s/" % self.pk
|
|
|
|
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
@python_2_unicode_compatible
|
2010-01-28 13:46:18 +00:00
|
|
|
class Article(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
|
|
|
entry = models.ForeignKey(Entry)
|
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(self):
|
2010-01-28 13:46:18 +00:00
|
|
|
return self.title
|