summaryrefslogtreecommitdiff
path: root/app/normalize/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/normalize/models.py')
-rw-r--r--app/normalize/models.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/normalize/models.py b/app/normalize/models.py
index f45f90b..8333681 100644
--- a/app/normalize/models.py
+++ b/app/normalize/models.py
@@ -1,4 +1,5 @@
from django.db import models
+from django.apps import apps
from django.contrib.contenttypes.models import ContentType
@@ -7,6 +8,7 @@ class RelatedPost(models.Model):
entry_id = models.IntegerField()
title = models.CharField(max_length=200)
slug = models.CharField(max_length=50)
+ post_type = models.CharField(null=True, blank=True, max_length=50)
pub_date = models.DateTimeField('Date published')
class Meta:
@@ -14,4 +16,8 @@ class RelatedPost(models.Model):
get_latest_by = 'pub_date'
def __str__(self):
- return "%s - %s" % (self.model_name, self.title)
+ if self.model_name.name == 'post':
+ p = apps.get_model("posts", "Post").objects.get(id=self.entry_id)
+ return "%s - %s" % (p.get_post_type_display(), self.title)
+ else:
+ return "%s - %s" % (self.model_name, self.title)