diff options
author | luxagraf <sng@luxagraf.net> | 2023-12-20 10:06:03 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-12-20 10:06:03 -0500 |
commit | 70bae74c82c2bece323dbb83794c6f0c79ef604d (patch) | |
tree | d51669a51ee0bfe16c5921af46506ea0854df5de /app/posts/views | |
parent | 47eb5bbf4d181cba4b200e9b16419d9797ad7be1 (diff) |
guides: fixed view code to show related
Diffstat (limited to 'app/posts/views')
-rw-r--r-- | app/posts/views/guide_views.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/posts/views/guide_views.py b/app/posts/views/guide_views.py index a4ff873..641da66 100644 --- a/app/posts/views/guide_views.py +++ b/app/posts/views/guide_views.py @@ -56,7 +56,11 @@ class GuideDetailView(LuxDetailView): def get_context_data(self, **kwargs): context = super(GuideDetailView, self).get_context_data(**kwargs) - print(self.kwargs['topic']) + 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 topic = Category.objects.get(slug=self.kwargs['topic']) context['topic'] = topic context['breadcrumbs'] = ('Guides', topic.name ) |