Increase buttons verbosity

This commit is contained in:
Gabriel Augendre 2018-05-24 00:19:32 +02:00
parent cff3aef98c
commit 35feb6178b
2 changed files with 5 additions and 1 deletions

View file

@ -8,7 +8,7 @@
<h1>Bienvenue {{ teacher.full_name }}</h1> <h1>Bienvenue {{ teacher.full_name }}</h1>
<h2> <h2>
{% block title %}Ajouter {{ item }}{% endblock %} {% block title %}Ajouter {{ item }}{% endblock %}
<a href="{% url 'list_books' teacher.pk %}" class="btn btn-secondary">Retour à la liste</a> <a href="{% url 'list_books' teacher.pk %}" class="btn btn-secondary">Retour à la liste des {{ item_plural }}</a>
</h2> </h2>
<form action="" method="post" class="form"> <form action="" method="post" class="form">
{% csrf_token %} {% csrf_token %}

View file

@ -61,11 +61,13 @@ class ListBooksView(BaseTeacherView, ListView):
class AddItemView(BaseTeacherView, CreateView): class AddItemView(BaseTeacherView, CreateView):
add_another = False add_another = False
item_text = None item_text = None
item_text_plural = None
success_target = None success_target = None
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['item'] = self.item_text context['item'] = self.item_text
context['item_plural'] = self.item_text_plural
return context return context
def get_initial(self): def get_initial(self):
@ -96,6 +98,7 @@ class AddBookView(AddItemView):
form_class = AddBookForm form_class = AddBookForm
success_target = 'add_book' success_target = 'add_book'
item_text = 'un livre' item_text = 'un livre'
item_text_plural = 'livres'
class AddSuppliesView(AddItemView): class AddSuppliesView(AddItemView):
@ -104,6 +107,7 @@ class AddSuppliesView(AddItemView):
form_class = AddSuppliesForm form_class = AddSuppliesForm
success_target = 'add_supplies' success_target = 'add_supplies'
item_text = 'des fournitures' item_text = 'des fournitures'
item_text_plural = 'fournitures'
def clear_teacher_view(request): def clear_teacher_view(request):