Django newbie question - I need to display a specific entry in a template. So far I have not been able to get this to work. I have the following code:
model:
class BasicPage(models.Model):
title = models.CharField(max_length=200)
body = HTMLField()
def __str__(self):
return self.title
view:
class TermsPageView(TemplateView):
model = BasicPage
template_name = 'terms.html'
def get_queryset(self):
body = BasicPage.objects.filter(id=1)
return body
template:
{% block content %}
<h1>{{ body.title }}</h1>
{% endblock content %}