I’m using Django to create a website to public my post, all of my post is pdf.
As usual, I defined my view and view logic, it returns a context dictionary
views.py
class PageView(TemplateView):
def get_context_data(self):
context = super().get_context_data(**kwargs)
highlightObject = Post.objects.filter(is_highlight = 1).order_by('-created_on')
context['highlight'] = highlightObject
return context
Then, on my html file
{% extends "base.html" %}
{% for row in highlight %}
<h3 class="mb-auto">{{ row. Title }}</h3>
<div class="btn-group">
<a href="{{ row.pdfFile.url }}" class="icon-link">Reading more</a>
</div>
{% endfor %}
Until now, when cliking on the “Reading more”, it changes to pdf Viewer, but I want to show pdf viewer inside html template, for example, it should change to other html file which extend the template from base.html
and show pdf viewer using path row.pdfFile.url
So, how to write a new html file for reading pdf from directory row.pdfFile.url
Or, if there is any other way to solve this problem.
Thanks