more cleanup

This commit is contained in:
Niko Abeler 2023-06-13 20:24:54 +02:00
parent 30b00b35e4
commit f91165d7b9
8 changed files with 55 additions and 16 deletions

View File

@ -3,19 +3,15 @@
{% block content %}
<h1>Home</h1>
<ul>
<li>
<a href="{% url 'guild:create_player' %}">Create New Player</a>
</li>
<li>
<a href="{% url 'guild:create_character' %}">Create New Character</a>
</li>
<li>
<a href="{% url 'guild:create_adventure' %}">Create New Adventure</a>
</li>
</ul>
<div class="row">
<div class="column column-75">
<h2>Adventures</h2>
</div>
<div class="column column-25">
<a class="button button-outline" href="{% url 'guild:create_adventure' %}">Create New Adventure</a>
</div>
</div>
<h2>Adventures</h2>
<ul>
{% for adventure in adventures %}
@ -25,7 +21,14 @@
{% endfor %}
</ul>
<h2>Characters</h2>
<div class="row">
<div class="column column-75">
<h2>Characters</h2>
</div>
<div class="column column-25">
<a class="button button-outline" href="{% url 'guild:create_character' %}">Create New Character</a>
</div>
</div>
<ul>
{% for character in characters %}
@ -35,7 +38,14 @@
{% endfor %}
</ul>
<h2>Players</h2>
<div class="row">
<div class="column column-75">
<h2>Players</h2>
</div>
<div class="column column-25">
<a class="button button-outline" href="{% url 'guild:create_player' %}">Create New Player</a>
</div>
</div>
<ul>
{% for player in players %}

View File

@ -3,9 +3,18 @@ import guild.views as views
import guild.views.player as player_views
import guild.views.character as character_views
import guild.views.adventure as adventure_views
from django.contrib.auth import views as auth_views
urlpatterns = [
path("", views.HomeView.as_view(), name="home"),
path("acounnt/login/", auth_views.LoginView.as_view(next_page="/"), name="login"),
path(
"account/logout/",
auth_views.LogoutView.as_view(
template_name="registration/logout.html",
),
name="logout",
),
# path("players/", views.PlayerListView.as_view(), name="player_list"),
path(
"players/create/", player_views.CreatePlayerView.as_view(), name="create_player"

0
guild/views/account.py Normal file
View File

View File

@ -50,6 +50,7 @@ class PlaySessionCreateView(LoginRequiredMixin, CreateView):
class PlaySessionUpdateView(LoginRequiredMixin, UpdateView):
model = PlaySession
form_class = PlaySessionForm
pk_url_kwarg = "playsession_pk"
def dispatch(self, request, *args, **kwargs):
self.adventure = get_object_or_404(Adventure, pk=kwargs["pk"])

View File

@ -19,6 +19,5 @@ from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
path("", include(("guild.urls", "guild"), namespace="guild")),
]

View File

@ -67,6 +67,17 @@
<li class="navigation-item">
<a href="{% url 'guild:character_list' %}">Characters</a>
</li>
{% if user.is_authenticated %}
<li class="navigation-item">
<a href="{% url 'guild:logout' %}">Logout</a>
</li>
{% else %}
<li class="navigation-item">
<a href="{% url 'guild:login' %}">Login</a>
</li>
{% endif %}
</ul>
</section>
</nav>

View File

@ -15,7 +15,7 @@
{% endif %}
{% endif %}
<form method="post" action="{% url 'login' %}">
<form method="post" action="{% url 'guild:login' %}">
{% csrf_token %}
{{form}}
<input type="submit" value="login">

View File

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block content %}
<h1>Logged Out</h1>
<p>You have been logged out. <a href="{% url 'guild:login' %}">Log in again</a>.</p>
{% endblock %}