Fix broken confirm delete page

This commit is contained in:
Gabriel Augendre 2018-06-17 12:30:28 +02:00
parent 7d72e633ed
commit 99d0f8b6c5
2 changed files with 6 additions and 1 deletions

View file

@ -25,7 +25,7 @@
{% endif %}
{% buttons %}
<button type="submit" class="btn btn-{{ button_class }}">
<i class="fas fa-check-circle"></i> {{ verb }}
<i class="{{ button_icon }}"></i> {{ verb }}
</button>
{% endbuttons %}
</form>

View file

@ -68,6 +68,7 @@ class ItemView(BaseTeacherView):
message_template = None
verb = None
button_class = 'primary'
button_icon = 'fas fa-check-circle'
def dispatch(self, request, *args, **kwargs):
response = super().dispatch(request, *args, **kwargs)
@ -83,6 +84,7 @@ class ItemView(BaseTeacherView):
context['message_template'] = self.message_template
context['verb'] = self.verb
context['button_class'] = self.button_class
context['button_icon'] = self.button_icon
return context
def get_initial(self):
@ -98,6 +100,7 @@ class ItemView(BaseTeacherView):
class AddItemView(ItemView, CreateView):
verb = 'Ajouter'
button_icon = 'fas fa-plus-circle'
def get_success_url(self):
if self.add_another:
@ -190,6 +193,8 @@ class DeleteItemView(ItemView, DeleteView):
message_template = 'manuels/confirm_delete.html'
verb = 'Supprimer'
button_class = 'danger'
button_icon = 'fas fa-trash'
template_name = 'manuels/add_supplies.html'
def get_queryset(self):
return self.model.objects.filter(teacher=self.teacher)