User menu
* starts user menu implementation
This commit is contained in:
parent
d50fb1a1d6
commit
41fff3a687
@ -62,6 +62,7 @@ INSTALLED_APPS = [
|
||||
'intervention',
|
||||
'organisation',
|
||||
'news',
|
||||
'user',
|
||||
]
|
||||
if DEBUG:
|
||||
INSTALLED_APPS += [
|
||||
|
@ -33,7 +33,7 @@ urlpatterns = [
|
||||
path('eco-account/', include("intervention.urls")), #ToDo
|
||||
path('ema/', include("intervention.urls")), #ToDo
|
||||
path('organisation/', include("organisation.urls")),
|
||||
path('user/', include("intervention.urls")), #ToDo
|
||||
path('user/', include("user.urls")),
|
||||
path('news/', include("news.urls")),
|
||||
|
||||
# Autocomplete paths
|
||||
|
@ -53,7 +53,7 @@
|
||||
{{ user.username }}
|
||||
</div>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="{% url 'logout' %}">{% fa5_icon 'cogs' %} {% trans 'Settings' %}</a>
|
||||
<a class="dropdown-item" href="{% url 'user:index' %}">{% fa5_icon 'cogs' %} {% trans 'Settings' %}</a>
|
||||
<a class="dropdown-item" href="{% url 'logout' %}">{% fa5_icon 'sign-out-alt' %} {% trans 'Logout' %}</a>
|
||||
</div>
|
||||
</li>
|
||||
|
0
user/__init__.py
Normal file
0
user/__init__.py
Normal file
3
user/admin.py
Normal file
3
user/admin.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
5
user/apps.py
Normal file
5
user/apps.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class UserConfig(AppConfig):
|
||||
name = 'user'
|
3
user/models.py
Normal file
3
user/models.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
22
user/templates/user/index.html
Normal file
22
user/templates/user/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-md-3 border">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>{% trans 'Username' %}</th>
|
||||
<td>{{user.username}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<td>{{user.first_name}} {{user.last_name}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
3
user/tests.py
Normal file
3
user/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
15
user/urls.py
Normal file
15
user/urls.py
Normal file
@ -0,0 +1,15 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 08.07.21
|
||||
|
||||
"""
|
||||
from django.urls import path
|
||||
|
||||
from user.views import index_view
|
||||
|
||||
app_name="user"
|
||||
urlpatterns = [
|
||||
path("", index_view, name="index"),
|
||||
]
|
23
user/views.py
Normal file
23
user/views.py
Normal file
@ -0,0 +1,23 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpRequest
|
||||
from django.shortcuts import render
|
||||
|
||||
from konova.contexts import BaseContext
|
||||
|
||||
|
||||
@login_required
|
||||
def index_view(request: HttpRequest):
|
||||
""" Renders the user's data index view
|
||||
|
||||
Args:
|
||||
request ():
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
template = "user/index.html"
|
||||
context = {
|
||||
"user": request.user,
|
||||
}
|
||||
context = BaseContext(request, context).context
|
||||
return render(request, template, context)
|
Loading…
Reference in New Issue
Block a user