2008-08-11 22:49:19 +02:00
|
|
|
from django.db import models
|
|
|
|
|
2011-10-13 23:34:56 +02:00
|
|
|
|
2008-08-11 22:49:19 +02:00
|
|
|
class Entry(models.Model):
|
|
|
|
title = models.CharField(max_length=200)
|
2013-07-17 21:20:20 +02:00
|
|
|
updated = models.DateTimeField()
|
|
|
|
published = models.DateTimeField()
|
2010-01-28 14:46:18 +01:00
|
|
|
|
|
|
|
class Meta:
|
2013-07-17 21:20:20 +02:00
|
|
|
ordering = ('updated',)
|
2010-01-28 14:46:18 +01:00
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
def __str__(self):
|
2010-01-28 14:46:18 +01: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 16:43:21 +02:00
|
|
|
entry = models.ForeignKey(Entry, models.CASCADE)
|