Add index.html as home

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

View file

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

View file

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

View file

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

View file

@ -8,8 +8,9 @@
{% block body %}
<nav>
<ul>
<li><a href="{% url 'index' %}">Home</a></li>
{% 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>
{% else %}
<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 %}