further setup

This commit is contained in:
Niko Abeler 2023-06-09 22:19:15 +02:00
parent d14383b86c
commit d2388c4d4c
8 changed files with 77 additions and 3 deletions

View File

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block content %}
<h1>Home</h1>
{% endblock content %}

6
guild/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
import guild.views as views
urlpatterns = [
path("", views.HomeView.as_view(), name="home"),
]

View File

@ -1,3 +1,6 @@
from django.shortcuts import render
from django.views.generic import TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin
# Create your views here.
class HomeView(LoginRequiredMixin, TemplateView):
template_name = "guild/home.html"

View File

@ -55,7 +55,9 @@ ROOT_URLCONF = 'guild_journal.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
BASE_DIR / "templates",
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -118,6 +120,10 @@ USE_TZ = True
STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

View File

@ -15,8 +15,10 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
path("", include("guild.urls")),
]

5
static/pico.min.css vendored Normal file

File diff suppressed because one or more lines are too long

19
templates/base.html Normal file
View File

@ -0,0 +1,19 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static 'pico.min.css' %}">
<title>Guild Journal</title>
</head>
<body>
<main class="container">
{% block content %}
{% endblock %}
</main>
</body>
</html>

View File

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block content %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
{% if next %}
{% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login to see this page.</p>
{% endif %}
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
{{form}}
<input type="submit" value="login">
<input type="hidden" name="next" value="{{ next }}">
</form>
{# Assumes you set up the password_reset view in your URLconf #}
{% comment %} <p><a href="{% url 'password_reset' %}">Lost password?</a></p> {% endcomment %}
{% endblock %}