2008-08-11 20:49:19 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 21:34:56 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
class Article(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
2015-07-22 14:43:21 +00:00
|
|
|
entry = models.ForeignKey(Entry, models.CASCADE)
|
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
|