From b966e140b82970820f9680ceb0591dfa7b2777ee Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 5 Feb 2018 16:25:32 +0100 Subject: [PATCH] Rework report import view and add individual student report send form --- common/settings.py | 2 +- common/urls.py | 4 +- stages/forms.py | 12 +- stages/static/img/envelope.png | Bin 0 -> 239 bytes stages/tests.py | 27 +++- stages/views.py | 163 +++++++++++++++--------- templates/admin/index.html | 1 - templates/class.html | 17 ++- templates/email/bulletins_scolaires.txt | 7 +- templates/email_base.html | 1 + templates/email_report.html | 5 + templates/file_import.html | 2 + 12 files changed, 167 insertions(+), 74 deletions(-) create mode 100644 stages/static/img/envelope.png create mode 100644 templates/email_report.html diff --git a/common/settings.py b/common/settings.py index 5ad26d1..63a7668 100644 --- a/common/settings.py +++ b/common/settings.py @@ -34,7 +34,7 @@ USE_TZ = False # Absolute filesystem path to the directory that will hold user-uploaded files. MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media') -MEDIA_URL = '' +MEDIA_URL = '/media/' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files diff --git a/common/urls.py b/common/urls.py index 44362a9..c1b16a5 100644 --- a/common/urls.py +++ b/common/urls.py @@ -12,7 +12,6 @@ urlpatterns = [ path('import_students/', views.StudentImportView.as_view(), name='import-students'), path('import_hp/', views.HPImportView.as_view(), name='import-hp'), path('import_hp_contacts/', views.HPContactsImportView.as_view(), name='import-hp-contacts'), - path('import_bulletins/', views.ImportBulletinView.as_view(), name='import-bulletins'), path('attribution/', views.AttributionView.as_view(), name='attribution'), re_path(r'^stages/export/(?Pall)?/?$', views.stages_export, name='stages_export'), @@ -21,6 +20,7 @@ urlpatterns = [ path('institutions//', views.CorporationView.as_view(), name='corporation'), path('classes/', views.KlassListView.as_view(), name='classes'), path('classes//', views.KlassView.as_view(), name='class'), + path('classes//import_reports/', views.ImportReportsView.as_view(), name='import-reports'), path('candidate//send_convocation/', candidats_views.ConvocationView.as_view(), name='candidate-convocation'), @@ -46,6 +46,8 @@ urlpatterns = [ path('training/by_period//', views.TrainingsByPeriodView.as_view()), path('student//summary/', views.StudentSummaryView.as_view()), + path('student//send_reports/sem//', views.SendStudentReportsView.as_view(), + name='send-student-reports'), path('availability//summary/', views.AvailabilitySummaryView.as_view()), path('corporation//contacts/', views.CorpContactJSONView.as_view()), ] diff --git a/stages/forms.py b/stages/forms.py index f7317f1..a14e93a 100644 --- a/stages/forms.py +++ b/stages/forms.py @@ -36,5 +36,15 @@ class UploadHPFileForm(forms.Form): upload = forms.FileField(label='Fichier HyperPlanning') -class UploadBulletinForm(forms.Form): +class UploadReportForm(forms.Form): + semester = forms.ChoiceField(label='Semestre', choices=(('1', '1'), ('2', '2')), required=True) upload = forms.FileField(label='Bulletins CLOEE (pdf)') + + +class EmailStudentBaseForm(forms.Form): + id_student = forms.CharField(widget=forms.HiddenInput()) + sender = forms.CharField(widget=forms.HiddenInput()) + to = forms.CharField(widget=forms.TextInput(attrs={'size': '60'})) + cci = forms.CharField(widget=forms.TextInput(attrs={'size': '60'})) + subject = forms.CharField(widget=forms.TextInput(attrs={'size': '60'})) + message = forms.CharField(widget=forms.Textarea(attrs={'rows': 20, 'cols': 120})) diff --git a/stages/static/img/envelope.png b/stages/static/img/envelope.png new file mode 100644 index 0000000000000000000000000000000000000000..abd128414f8895469ca14565fca71fef5bc94c1d GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^Vn8g!!3HGbRrPd%6kC$Fy9>jA5L~c#`DCC7XMsm# zF#`j)FbFd;%$g$s6l5>)^mS!_#Kg)csW$WKrYS(78c!F;5R21SuXuAc81S%MaM^SH z$+O}ug{oh~UAH(f$BN9FE_7>$%FUJ=IYBi=7smM~WIFc?g_`*pX1 zCWF!D)2t3E?k!ptN~@Y98^u&scAR)Importer un fichier d'étudiants
  • Importer le fichier HP
  • Importer les formateurs (fichier HP)
  • -
  • Envoyer les bulletins (par classe)
  • Exporter les données de stages (récentes)
  • Exporter les données de stages (toutes)
  • Exporter les données comptables
  • diff --git a/templates/class.html b/templates/class.html index d673c0e..40583a6 100644 --- a/templates/class.html +++ b/templates/class.html @@ -10,15 +10,30 @@ {% block content %}

    {{ klass.name }}

    +
    -

    Récapitulatif des stages

    +

    Liste des éléves

    + {% for student in students %} + {% for train in student.training_set.all %}
    Nom, prénomDate naiss.BulletinsRécapitulatif des stages
    {{ student }} {{ student.birth_date }}{% if student.report_sem1 %}Sem. 1 + {% if student.report_sem1_sent %}{% else %} + + {% endif %} + {% endif %} + {% if student.report_sem2 %}
    Sem. 2 + {% if student.report_sem2_sent %}{% else %} + + {% endif %} + {% endif %} +
    {{ train.availability.period }}
    {{ train.availability.corporation }}
    {% if train.comment %}
    {% endif %} diff --git a/templates/email/bulletins_scolaires.txt b/templates/email/bulletins_scolaires.txt index db98d9e..6752f82 100644 --- a/templates/email/bulletins_scolaires.txt +++ b/templates/email/bulletins_scolaires.txt @@ -1,11 +1,10 @@ Madame, Monsieur, -Vous trouverez en annexe le bulletin scolaire de {{ student_name }} pour le semestre écoulé. +Vous trouverez en annexe le bulletin scolaire de {{student.civility }} {{ student.full_name }} pour le semestre écoulé. Nous vous souhaitons bonne réception de ce document et vous prions de recevoir, Madame, Monsieur, nos salutations les plus cordiales. Secrétariat de l'EPC +{{ sender.first_name }} {{ sender.last_name }} +{{ sender.email }} tél. 032 886 33 00 - -{{ sender_name }} -{{ sender_email }} diff --git a/templates/email_base.html b/templates/email_base.html index d0602da..3befe06 100644 --- a/templates/email_base.html +++ b/templates/email_base.html @@ -16,5 +16,6 @@
    +{% block post_form %}{% endblock %} {% endblock %} diff --git a/templates/email_report.html b/templates/email_report.html new file mode 100644 index 0000000..2a02a42 --- /dev/null +++ b/templates/email_report.html @@ -0,0 +1,5 @@ +{% extends "email_base.html" %} + +{% block post_form %} +Bulletin qui sera joint au message: {{ pdf_field.name }} +{% endblock %} diff --git a/templates/file_import.html b/templates/file_import.html index 62d6284..15659cb 100644 --- a/templates/file_import.html +++ b/templates/file_import.html @@ -8,6 +8,8 @@ {% endblock %} {% block content %} +

    {{ view.title }}

    +
    {% csrf_token %} {{ form.as_p }}