From 68de1aefeadc6abf1ef7c0ffc518c846a7dbfb6f Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 2 Jun 2018 17:51:53 +0200 Subject: [PATCH] Implement teacher lists confirmation. #19 --- .../0022_teacher_has_confirmed_list.py | 18 +++++ manuels/models.py | 5 ++ .../templates/manuels/confirm_teacher.html | 29 +++++++ .../manuels/list_books_supplies.html | 75 ++++++++++++------- manuels/urls.py | 3 +- manuels/views.py | 21 +++++- manuels_collection/settings.py | 5 ++ 7 files changed, 128 insertions(+), 28 deletions(-) create mode 100644 manuels/migrations/0022_teacher_has_confirmed_list.py create mode 100644 manuels/templates/manuels/confirm_teacher.html diff --git a/manuels/migrations/0022_teacher_has_confirmed_list.py b/manuels/migrations/0022_teacher_has_confirmed_list.py new file mode 100644 index 0000000..592c7c8 --- /dev/null +++ b/manuels/migrations/0022_teacher_has_confirmed_list.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.5 on 2018-06-02 15:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('manuels', '0021_auto_20180602_1638'), + ] + + operations = [ + migrations.AddField( + model_name='teacher', + name='has_confirmed_list', + field=models.BooleanField(default=False, verbose_name='a confirmé les listes'), + ), + ] diff --git a/manuels/models.py b/manuels/models.py index ffbd7b4..6722e1e 100644 --- a/manuels/models.py +++ b/manuels/models.py @@ -48,6 +48,11 @@ class Teacher(BaseModel): help_text='Utilisée pour vous transmettre votre lien personnel', unique=True ) + has_confirmed_list = models.BooleanField( + 'a confirmé les listes', + default=False, + blank=True + ) def get_absolute_url(self): from django.urls import reverse diff --git a/manuels/templates/manuels/confirm_teacher.html b/manuels/templates/manuels/confirm_teacher.html new file mode 100644 index 0000000..3ac300b --- /dev/null +++ b/manuels/templates/manuels/confirm_teacher.html @@ -0,0 +1,29 @@ +{% extends 'manuels/base.html' %} + +{% load bootstrap4 %} +{% load static %} + +{% block content %} +
+
+

Bienvenue {{ teacher.full_name }}

+

+ {% block title %}Confirmer les listes{% endblock %} + Retour à vos listes +

+
+

Danger

+

+ Êtes-vous certain·e de vouloir confirmer vos listes ? + Cette action est définitive : vous ne pourrez plus les modifier ensuite. +

+
+
+ {% csrf_token %} + {% buttons %} + + {% endbuttons %} +
+
+
+{% endblock %} diff --git a/manuels/templates/manuels/list_books_supplies.html b/manuels/templates/manuels/list_books_supplies.html index d847c75..fe9f859 100644 --- a/manuels/templates/manuels/list_books_supplies.html +++ b/manuels/templates/manuels/list_books_supplies.html @@ -7,8 +7,15 @@ {% block content %}
-

Bienvenue {{ teacher.full_name }} Se - déconnecter

+

Bienvenue {{ teacher.full_name }} + + Se déconnecter + + {% if not teacher.has_confirmed_list %} + + Confirmer ma liste + {% endif %} +