Add index.html as home

This commit is contained in:
Benjamin 2022-12-28 10:58:23 +01:00
parent 27075d101f
commit d39ffc822c
5 changed files with 15 additions and 4 deletions

View file

@ -100,6 +100,7 @@ AUTH_PASSWORD_VALIDATORS = [
}, },
] ]
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/'
# Internationalization # Internationalization

View file

@ -18,6 +18,7 @@ from django.urls import path, include
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('accounts/new-user/', views.new_user, name='new-user'), path('accounts/new-user/', views.new_user, name='new-user'),
path('accounts/profile/', views.profile, name='profile'), path('accounts/profile/', views.profile, name='profile'),

View file

@ -19,3 +19,6 @@ def new_user(request):
@login_required @login_required
def profile(request): def profile(request):
return render(request, 'registration/profile.html') return render(request, 'registration/profile.html')
def index(request):
return render(request, 'index.html')

View file

@ -8,8 +8,9 @@
{% block body %} {% block body %}
<nav> <nav>
<ul> <ul>
<li><a href="{% url 'index' %}">Home</a></li>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<li><a href="{% url 'profile' %}">Profile</a></li> <li><a href="{% url 'profile' %}">Profile {{ user.username }}</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li> <li><a href="{% url 'logout' %}">Logout</a></li>
{% else %} {% else %}
<li><a href="{% url 'login' %}">Login</a></li> <li><a href="{% url 'login' %}">Login</a></li>

5
templates/index.html Normal file
View file

@ -0,0 +1,5 @@
{% extends "base_main.html" %}
{% block title %}Barn{% endblock %}
{% block main %}
<h1>Barn</h1>
{% endblock %}