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 %} {% block content %}
<h1>Home</h1> <h1>Home</h1>
<ul> <div class="row">
<li> <div class="column column-75">
<a href="{% url 'guild:create_player' %}">Create New Player</a> <h2>Adventures</h2>
</li> </div>
<li> <div class="column column-25">
<a href="{% url 'guild:create_character' %}">Create New Character</a> <a class="button button-outline" href="{% url 'guild:create_adventure' %}">Create New Adventure</a>
</li> </div>
<li> </div>
<a href="{% url 'guild:create_adventure' %}">Create New Adventure</a>
</li>
</ul>
<h2>Adventures</h2>
<ul> <ul>
{% for adventure in adventures %} {% for adventure in adventures %}
@ -25,7 +21,14 @@
{% endfor %} {% endfor %}
</ul> </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> <ul>
{% for character in characters %} {% for character in characters %}
@ -35,7 +38,14 @@
{% endfor %} {% endfor %}
</ul> </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> <ul>
{% for player in players %} {% 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.player as player_views
import guild.views.character as character_views import guild.views.character as character_views
import guild.views.adventure as adventure_views import guild.views.adventure as adventure_views
from django.contrib.auth import views as auth_views
urlpatterns = [ urlpatterns = [
path("", views.HomeView.as_view(), name="home"), 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/", views.PlayerListView.as_view(), name="player_list"),
path( path(
"players/create/", player_views.CreatePlayerView.as_view(), name="create_player" "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): class PlaySessionUpdateView(LoginRequiredMixin, UpdateView):
model = PlaySession model = PlaySession
form_class = PlaySessionForm form_class = PlaySessionForm
pk_url_kwarg = "playsession_pk"
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
self.adventure = get_object_or_404(Adventure, pk=kwargs["pk"]) self.adventure = get_object_or_404(Adventure, pk=kwargs["pk"])

View File

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

View File

@ -67,6 +67,17 @@
<li class="navigation-item"> <li class="navigation-item">
<a href="{% url 'guild:character_list' %}">Characters</a> <a href="{% url 'guild:character_list' %}">Characters</a>
</li> </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> </ul>
</section> </section>
</nav> </nav>

View File

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