mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-05 06:13:55 +01:00
Add basic character create view (redirect only)
This commit is contained in:
parent
36047f0720
commit
881e069ed0
4 changed files with 11 additions and 2 deletions
|
@ -9,7 +9,7 @@
|
||||||
{{ character.get_gender_display }}, {{ character.age }} ans, {{ character.height_m }}m, {{ character.weight }}kg<br>
|
{{ character.get_gender_display }}, {{ character.age }} ans, {{ character.height_m }}m, {{ character.weight }}kg<br>
|
||||||
PV {{ character.health_remaining }}/{{ character.health_max }}, PM {{ character.mana_remaining }}/{{ character.mana_max }}
|
PV {{ character.health_remaining }}/{{ character.health_max }}, PM {{ character.mana_remaining }}/{{ character.mana_max }}
|
||||||
</p>
|
</p>
|
||||||
<a href="{% url "character:view" pk=character.pk %}" class="btn btn-sm btn-primary">
|
<a href="{% url "character:view" pk=character.pk %}" class="btn btn-sm btn-success">
|
||||||
<i class="fa-solid fa-user"></i> Play
|
<i class="fa-solid fa-user"></i> Play
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Characters</h1>
|
<h1>Characters</h1>
|
||||||
|
<a href="{% url "character:create" %}" class="btn btn-primary mb-3">
|
||||||
|
<i class="fa-solid fa-user-plus"></i> New character
|
||||||
|
</a>
|
||||||
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 g-4">
|
<div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 g-4">
|
||||||
{% for character in characters %}
|
{% for character in characters %}
|
||||||
{% include "character/character_card.html" %}
|
{% include "character/character_card.html" %}
|
||||||
|
|
|
@ -5,6 +5,7 @@ from character import views
|
||||||
app_name = "character"
|
app_name = "character"
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.characters_list, name="list"),
|
path("", views.characters_list, name="list"),
|
||||||
|
path("create/", views.character_create, name="create"),
|
||||||
path("<int:pk>/", views.character_view, name="view"),
|
path("<int:pk>/", views.character_view, name="view"),
|
||||||
path("<int:pk>/health_change", views.character_health_change, name="health_change"),
|
path("<int:pk>/health_change", views.character_health_change, name="health_change"),
|
||||||
path("<int:pk>/mana_change", views.character_mana_change, name="mana_change"),
|
path("<int:pk>/mana_change", views.character_mana_change, name="mana_change"),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django_htmx.http import trigger_client_event
|
from django_htmx.http import trigger_client_event
|
||||||
|
|
||||||
from character.forms import EquipmentForm
|
from character.forms import EquipmentForm
|
||||||
|
@ -17,6 +17,11 @@ def characters_list(request):
|
||||||
return render(request, "character/list.html", context)
|
return render(request, "character/list.html", context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def character_create(request):
|
||||||
|
return redirect("admin:character_character_add")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def character_view(request, pk: int):
|
def character_view(request, pk: int):
|
||||||
character = get_object_or_404(
|
character = get_object_or_404(
|
||||||
|
|
Loading…
Reference in a new issue