Implement group management features and update templates for improved navigation
This commit is contained in:
parent
f3e914aed8
commit
088bb52c07
9 changed files with 80 additions and 37 deletions
11
base/templates/base/inline_form.html
Normal file
11
base/templates/base/inline_form.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% for error in form.non_field_errors %}<article class="message error">{{ error }}</article>{% endfor %}
|
||||
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
|
||||
{% csrf_token %}
|
||||
<fieldset role="group">
|
||||
{% for field in form %}{{ field }}{% endfor %}
|
||||
<input type="submit" {% if submit %}value="{{ submit }}"{% endif %}>
|
||||
{% if field.errors %}
|
||||
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
</form>
|
|
@ -4,7 +4,7 @@
|
|||
<i class="ri-music-ai-fill big-logo"></i>
|
||||
<h1>Musik</h1>
|
||||
<p>
|
||||
<a href="{% url "login" %}" role="button"><i class="ri-play-fill"></i> Jouer</a>
|
||||
<a href="{% url "home" %}" role="button"><i class="ri-play-fill"></i> Jouer</a>
|
||||
</p>
|
||||
</main>
|
||||
<footer>
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% include "game/home.html" %}
|
||||
{% endblock content %}
|
||||
{% block body %}
|
||||
{% if user.is_authenticated %}
|
||||
{{ block.super }}
|
||||
{% else %}
|
||||
{% include "hero.html" %}
|
||||
{% endif %}
|
||||
{% include "hero.html" %}
|
||||
{% endblock body %}
|
||||
|
|
|
@ -4,8 +4,13 @@ register = template.Library()
|
|||
|
||||
|
||||
@register.inclusion_tag("base/form.html")
|
||||
def form(form, **kwargs):
|
||||
def form(f, **kwargs):
|
||||
return kwargs | {
|
||||
"form": form,
|
||||
"errors": form.errors,
|
||||
"form": f,
|
||||
"errors": f.errors,
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag("base/inline_form.html")
|
||||
def inline_form(f, **kwargs):
|
||||
return form(f, **kwargs)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import CreateView
|
||||
|
@ -10,6 +11,11 @@ from . import forms
|
|||
class HomePageView(TemplateView):
|
||||
template_name = "index.html"
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if request.user.is_authenticated:
|
||||
return redirect("home")
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
class SignupView(SuccessMessageMixin, CreateView):
|
||||
model = User
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue