Add profile view

This commit is contained in:
Tobias Kunze 2025-03-16 20:19:58 +01:00
parent 090985c3e9
commit 31d8016d7b
4 changed files with 57 additions and 3 deletions

View file

@ -0,0 +1 @@
{% extends "frontend/base.html" %}

View file

@ -0,0 +1,43 @@
{% extends "frontend/base.html" %}
{% load i18n %}
{% block html_title %}
{% block page_title %}
{% translate "Profile" %}
{% endblock page_title %}
{% endblock html_title %}
{% block content %}
<section class="section">
<div class="card">
<div class="card-header">
<h4 class="card-title">{% translate "Account" %}</h4>
</div>
<div class="card-content">
<div class="card-body">
<p class="card-text">
{% blocktranslate trimmed %}
You are logged in with your VSHN user account. You will be able to change your password and other settings here in the future.
{% endblocktranslate %}
</p>
<div class="table-responsive">
<table class="table table-lg">
<tbody>
<tr>
<th>{% translate "E-mail" %}</th>
<td>{{ request.user.email }}</td>
</tr>
<tr>
<th>{% translate "First name" %}</th>
<td>{{ request.user.first_name }}</td>
</tr>
<tr>
<th>{% translate "Last name" %}</th>
<td>{{ request.user.last_name }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
{% endblock content %}

View file

@ -2,4 +2,8 @@ from django.views.generic import TemplateView
class IndexView(TemplateView): class IndexView(TemplateView):
template_name = "frontend/base.html" template_name = "frontend/index.html"
class ProfileView(TemplateView):
template_name = "frontend/profile.html"

View file

@ -2,17 +2,23 @@ from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from django.urls.conf import include
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from servala.frontend.views import IndexView from servala.frontend import views
admin.site.site_title = _("Servala Admin") admin.site.site_title = _("Servala Admin")
admin.site.site_header = _("Servala Management") admin.site.site_header = _("Servala Management")
admin.site.index_title = _("Dashboard") admin.site.index_title = _("Dashboard")
urlpatterns = [ urlpatterns = [
path("", IndexView.as_view(), name="index"), # This adds the allauth urls to the project:
# - accounts/keycloak/login/
# - accounts/keycloak/login/callback/
path("accounts/", include("allauth.urls")),
path("accounts/profile/", views.ProfileView.as_view(), name="profile"),
path("admin/", admin.site.urls), path("admin/", admin.site.urls),
path("", views.IndexView.as_view(), name="index"),
] ]
# Serve static and media files in development # Serve static and media files in development