feat: club create form
This commit is contained in:
parent
c74b3fcd65
commit
9dfb5643bf
4 changed files with 45 additions and 1 deletions
|
@ -21,6 +21,9 @@ class Club(models.Model):
|
|||
related_name="managed_budgets_set",
|
||||
)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("cof_clubs:club-detail", kwargs={"pk": self.pk})
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
31
cof_clubs/templates/cof_clubs/club_form.html
Normal file
31
cof_clubs/templates/cof_clubs/club_form.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{% extends "cof_clubs/base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<h1 class="title">{% trans "Création/Modification d'un club" %}</h1>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "bulma/form.html" with errors=True form=form %}
|
||||
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
<button class="button is-primary" type="submit">
|
||||
<span>{% trans "Enregister" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% if not object %}
|
||||
<div class="control">
|
||||
<button class="button is-secondary" type="submit" name="_addanother">
|
||||
<span>{% trans "Enregister et ajouter un nouveau" %}</span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -4,7 +4,12 @@
|
|||
{% block content %}
|
||||
<div class="section">
|
||||
<div class="content">
|
||||
<h1>Liste des clubs gérés</h1>
|
||||
<h1 class="buttons">
|
||||
Liste des clubs gérés
|
||||
{% if user.profile.is_buro %}
|
||||
<a class="button" href="{% url "cof_clubs:club-create" %}"><span class="icon"><i class="fa fa-plus"></i></span></a>
|
||||
{% endif %}
|
||||
</h1>
|
||||
<table class="table is-bordered is-striped is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -11,6 +11,11 @@ from .forms import ClubBudgetLineForm
|
|||
from .models import Club, ClubBudgetAccountingPeriod, ClubBudgetLine
|
||||
|
||||
|
||||
class ClubCreateView(BuroRequiredMixin, CreateView):
|
||||
model = Club
|
||||
fields = ["name", "description", "respos", "budget_managers"]
|
||||
|
||||
|
||||
class ClubListView(LoginRequiredMixin, TemplateView):
|
||||
template_name = "cof_clubs/club_list.html"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue