diff options
Diffstat (limited to 'apps/pages/views.py')
-rw-r--r-- | apps/pages/views.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/pages/views.py b/apps/pages/views.py index 617ce04..4ace41b 100644 --- a/apps/pages/views.py +++ b/apps/pages/views.py @@ -1,4 +1,5 @@ from django.views.generic.detail import DetailView +from django.contrib.auth.forms import AuthenticationForm from pages.models import Page @@ -9,3 +10,9 @@ class PageDetailView(DetailView): def get_template_names(self): obj = self.get_object() return ["pages/%s.html" % obj.slug, 'pages/page.html'] + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + if self.request.user.is_anonymous: + context['login_form'] = AuthenticationForm() + return context |