diff options
Diffstat (limited to 'app/posts/views')
-rw-r--r-- | app/posts/views/src_views.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/posts/views/src_views.py b/app/posts/views/src_views.py index 990088f..90c672c 100644 --- a/app/posts/views/src_views.py +++ b/app/posts/views/src_views.py @@ -1,5 +1,6 @@ from django.views.generic import ListView from django.views.generic.detail import DetailView +from django.apps import apps from django.contrib.syndication.views import Feed from django.urls import reverse from django.conf import settings @@ -31,6 +32,14 @@ class SrcDetailView(DetailView): slug_field = "slug" template_name="posts/src_detail.html" + def get_context_data(self, **kwargs): + context = super(SrcDetailView, self).get_context_data(**kwargs) + related = [] + for obj in self.object.related.all(): + model = apps.get_model(obj.model_name.app_label, obj.model_name.model) + related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date)) + context['related'] = related + return context class SrcDetailViewTXT(SrcDetailView): template_name = "posts/jrnl_detail.txt" |