redirect to current page after login/logout

This commit is contained in:
Valentin Gagarin 2025-02-18 17:12:33 +01:00
parent 6d0fdd0834
commit 73c9c884d7
4 changed files with 16 additions and 2 deletions

View file

@ -17,9 +17,9 @@
<body>
<header>
{% if user.is_authenticated %}
<p>Welcome, {{ user.username }}! <a href="{% url 'logout' %}">Logout</a></p>
<p>Welcome, {{ user.username }}! <a href="{% url 'logout' %}?next={{ request.path }}">Logout</a></p>
{% else %}
<p><a href="{% url 'login' %}">Login</a></p>
<p><a href="{% url 'login' %}?next={{ request.path }}">Login</a></p>
{% endif %}
</header>
{% block navigation %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
<h1>Fediverse services</h1>
<dl>
<dt>Hello world service</dt>
<dd>Nothing to see here</dd>
</dl>
{% endblock %}

View file

@ -23,4 +23,5 @@ urlpatterns = [
path('', views.Index.as_view(), name='index'),
path("", include("django.contrib.auth.urls")),
path("account/", views.AccountDetail.as_view(), name='accountdetail')
path("services/", views.ServiceList.as_view(), name='service_list'),
]

View file

@ -11,3 +11,6 @@ class AccountDetail(LoginRequiredMixin, DetailView):
template_name = 'accountdetail.html'
def get_object(self):
return self.request.user
class ServiceList(TemplateView):
template_name = 'service_list.html'