diff --git a/.gitignore b/.gitignore
index cdd541d..a5cc6aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
database.db
common/local_settings.py
scripts/epcstages.json
+.idea/*
diff --git a/.idea/dictionaries/alzo.xml b/.idea/dictionaries/alzo.xml
new file mode 100644
index 0000000..331a0fe
--- /dev/null
+++ b/.idea/dictionaries/alzo.xml
@@ -0,0 +1,17 @@
+
+
+
+ créés
+ domaine
+ erreurs
+ klass
+ modifiés
+ naissance
+ objets
+ pcode
+ prénom
+ rencontrées
+ étudiants
+
+
+
\ No newline at end of file
diff --git a/.idea/epcstages.iml b/.idea/epcstages.iml
new file mode 100644
index 0000000..6711606
--- /dev/null
+++ b/.idea/epcstages.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..411e19c
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b29c312
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..212be0b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..dbbe50d
--- /dev/null
+++ b/.idea/workspace.xml
@@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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stages/admin.py b/stages/admin.py
index 77f2f23..13afc76 100644
--- a/stages/admin.py
+++ b/stages/admin.py
@@ -3,13 +3,13 @@ import tempfile
import zipfile
from collections import OrderedDict
+from datetime import date, datetime
from django import forms
from django.contrib import admin
from django.db import models
from django.db.models import Case, Count, When
from django.http import HttpResponse
from django.core.mail import send_mail
-from datetime import date, datetime
from openpyxl import Workbook
from openpyxl.styles import Font, Style
@@ -18,7 +18,7 @@ from stages.models import (
Teacher, Option, Student, Section, Level, Klass, Corporation,
CorpContact, Domain, Period, Availability, Training, Course,
District, Candidate, Config
-)
+ )
from django.db.models import BooleanField
from .forms import CandidateAdminForm
from stages.pdf import ChargeSheetPDF
@@ -108,13 +108,6 @@ class StudentAdmin(admin.ModelAdmin):
student.save()
archive.short_description = "Marquer les étudiants sélectionnés comme archivés"
- '''def get_readonly_fields(self, request, obj=None):
- if 'edit' not in request.GET:
- return self.fields
- else:
- return self.readonly_fields
- '''
-
class CorpContactAdmin(admin.ModelAdmin):
list_display = ('__str__', 'corporation', 'role')
@@ -270,6 +263,7 @@ def send_confirmation_mail(modeladmin, request, queryset):
cand.date_confirmation_mail = datetime.now()
cand.save()
return
+
send_confirmation_mail.short_description = "Envoyer email de confirmation"
@@ -282,6 +276,10 @@ def export_candidates(modeladmin, request, queryset):
export_fields['Canton'] = 'district__abrev'
export_fields['Employeur'] = 'corporation__name'
export_fields['Employeur_localite'] = 'corporation__city'
+
+ export_fields = OrderedDict([(f.verbose_name, f.name) for f in Candidate._meta.get_fields()])
+ export_fields['Canton'] = 'district__abrev'
+ export_fields['Employeur'] = 'corporation__name'
export_fields['FEE/FPP'] = 'instructor__last_name'
del export_fields['ID']
@@ -315,6 +313,14 @@ class CandidateAdmin(admin.ModelAdmin):
list_display = ('last_name', 'first_name', 'section', 'option', 'confirm_email')
list_filter = ('section', 'option', )
readonly_fields = ('total_result_points', 'total_result_mark', 'date_confirmation_mail')
+
+export_candidates.short_description = "Exporter les candidats sélectionnés"
+
+
+class CandidateAdmin(admin.ModelAdmin):
+ list_display = ('last_name', 'first_name', 'section', 'confirm_email')
+ list_filter = ('section', 'option', )
+ readonly_fields = ('total_result_points', 'total_result_mark', 'date_confirmation_mail', )
actions = [send_confirmation_mail, export_candidates]
fieldsets = (
(None, {
@@ -326,11 +332,14 @@ class CandidateAdmin(admin.ModelAdmin):
('corporation', 'instructor'),
('deposite_date', 'date_confirmation_mail', 'canceled_file', ),
'comment',
+ ('deposite_date', 'date_confirmation_mail')
),
}),
("FE", {
'classes': ('collapse',),
'fields': (('exemption_ecg', 'integration_second_year', 'validation_sfpo'),),
+ 'fields': ('exemption_ecg',),
+
}),
("EDE/EDS", {
'classes': ('collapse',),
@@ -338,6 +347,7 @@ class CandidateAdmin(admin.ModelAdmin):
'police_record', 'certif_of_800h', 'reflexive_text', 'work_certificate', 'marks_certificate',
'proc_admin_ext', 'promise', 'contract'),
+ 'comment',
('interview_date', 'interview_room'),
('examination_result', 'interview_result', 'file_result', 'total_result_points',
'total_result_mark')
diff --git a/stages/migrations/0003_ame=Add_Candidate_model.py b/stages/migrations/0003_ame=Add_Candidate_model.py
new file mode 100644
index 0000000..e32b44d
--- /dev/null
+++ b/stages/migrations/0003_ame=Add_Candidate_model.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-09-05 16:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('stages', '0002_add_student_option_ase'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Candidate',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('first_name', models.CharField(max_length=40, verbose_name='Prénom')),
+ ('last_name', models.CharField(max_length=40, verbose_name='Nom')),
+ ('gender', models.CharField(choices=[('M', 'Masculin'), ('F', 'Féminin'), ('I', 'Inconnu')], max_length=3, verbose_name='Genre')),
+ ('birth_date', models.DateField(blank=True, verbose_name='Date de naissance')),
+ ('street', models.CharField(blank=True, max_length=150, verbose_name='Rue')),
+ ('pcode', models.CharField(max_length=4, verbose_name='Code postal')),
+ ('city', models.CharField(max_length=40, verbose_name='Localité')),
+ ('tel', models.CharField(blank=True, max_length=40, verbose_name='Téléphone')),
+ ('mobile', models.CharField(blank=True, max_length=40, verbose_name='Portable')),
+ ('email', models.EmailField(blank=True, max_length=254, verbose_name='Courriel')),
+ ('avs', models.CharField(blank=True, max_length=15, verbose_name='No AVS')),
+ ('handicap', models.BooleanField(default=False)),
+ ('exemption_ecg', models.BooleanField(default=False)),
+ ('date_confirmation_mail', models.DateField(auto_now_add=True, verbose_name='Mail de confirmation')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='District',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('abrev', models.CharField(max_length=10)),
+ ('name', models.CharField(max_length=30)),
+ ],
+ ),
+
+ migrations.AddField(
+ model_name='candidate',
+ name='district',
+ field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='stages.District'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='option',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='stages.Option'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='section',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='stages.Section'),
+ ),
+ ]
diff --git a/stages/migrations/0004_ame=Add_EdsCandidate_model.py b/stages/migrations/0004_ame=Add_EdsCandidate_model.py
new file mode 100644
index 0000000..2666f4f
--- /dev/null
+++ b/stages/migrations/0004_ame=Add_EdsCandidate_model.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-09-05 17:06
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('stages', '0003_ame=Add_Candidate_model'),
+ ]
+
+ operations = [
+ ]
diff --git a/stages/migrations/0005_ame=Ame_Candidate.py b/stages/migrations/0005_ame=Ame_Candidate.py
new file mode 100644
index 0000000..76aafbe
--- /dev/null
+++ b/stages/migrations/0005_ame=Ame_Candidate.py
@@ -0,0 +1,169 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.2 on 2017-09-07 14:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('stages', '0004_ame=Add_EdsCandidate_model'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Config',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('key', models.CharField(max_length=100)),
+ ('value', models.TextField()),
+ ('comment', models.TextField()),
+ ],
+ ),
+ migrations.RemoveField(
+ model_name='candidate',
+ name='tel',
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='certif_of_800h',
+ field=models.BooleanField(default=False, verbose_name='Attest. 800h.'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='certif_of_cfc',
+ field=models.BooleanField(default=False, verbose_name='CFC'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='certificate_of_payement',
+ field=models.BooleanField(default=False, verbose_name='Attest. paiement'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='comment',
+ field=models.TextField(blank=True, default='', verbose_name='Remarques'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='contract',
+ field=models.BooleanField(default=False, verbose_name='Contrat valide'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='corporation',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='stages.Corporation', verbose_name='Employeur'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='cv',
+ field=models.BooleanField(default=False, verbose_name='CV'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='deposite_date',
+ field=models.DateField(blank=True, default=None, null=True, verbose_name='Date dépôt dossier'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='examination_result',
+ field=models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Points examen'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='file_result',
+ field=models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Points dossier'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='instructor',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='stages.CorpContact', verbose_name='FEE/FPP'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='interview_date',
+ field=models.DateTimeField(blank=True, default=None, null=True, verbose_name='Date entretien prof.'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='interview_result',
+ field=models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Points entretien prof.'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='interview_room',
+ field=models.CharField(blank=True, max_length=50, verbose_name="Salle d'entretien prof."),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='marks_certificate',
+ field=models.BooleanField(default=False, verbose_name='Bull. notes'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='police_record',
+ field=models.BooleanField(default=False, verbose_name='Casier judic.'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='proc_admin_ext',
+ field=models.BooleanField(default=False, verbose_name='Insc. autre école'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='promise',
+ field=models.BooleanField(default=False, verbose_name="Promesse d'eng."),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='reflexive_text',
+ field=models.BooleanField(default=False, verbose_name='Texte réflexif'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='registration_form',
+ field=models.BooleanField(default=False, verbose_name="Formulaire d'inscription"),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='total_result_mark',
+ field=models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Note finale'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='total_result_points',
+ field=models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Total points'),
+ ),
+ migrations.AddField(
+ model_name='candidate',
+ name='work_certificate',
+ field=models.BooleanField(default=False, verbose_name='Certif. de travail'),
+ ),
+ migrations.AlterField(
+ model_name='candidate',
+ name='birth_date',
+ field=models.DateField(blank=True, default=None, null=True, verbose_name='Date de naissance'),
+ ),
+ migrations.AlterField(
+ model_name='candidate',
+ name='date_confirmation_mail',
+ field=models.DateField(blank=True, default=None, null=True, verbose_name='Mail de confirmation'),
+ ),
+ migrations.AlterField(
+ model_name='candidate',
+ name='district',
+ field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='stages.District', verbose_name='Canton'),
+ ),
+ migrations.AlterField(
+ model_name='candidate',
+ name='option',
+ field=models.CharField(blank=True, max_length=20, null=True),
+ ),
+ migrations.AlterField(
+ model_name='candidate',
+ name='section',
+ field=models.CharField(choices=[('ASA', 'Aide en soin et accompagnement AFP'), ('ASE', 'Assist. socio-éducatif-ve CFC'), ('ASSC', 'Assist. en soin et santé communautaire CFC'), ('EDE', "Educ. de l'enfance, dipl. ES"), ('EDS', 'Educ. social-e, dipl. ES')], max_length=10, verbose_name='Filière'),
+ ),
+ ]
diff --git a/stages/models.py b/stages/models.py
index 439704e..2fb5b20 100644
--- a/stages/models.py
+++ b/stages/models.py
@@ -1,4 +1,5 @@
import json
+from django.utils import timezone
from collections import OrderedDict
from datetime import date, timedelta
@@ -67,7 +68,7 @@ class Teacher(models.Model):
archived = models.BooleanField(default=False)
class Meta:
- verbose_name='Enseignant'
+ verbose_name ='Enseignant'
ordering = ('last_name', 'first_name')
def __str__(self):
@@ -404,6 +405,7 @@ class Course(models.Model):
"""Cours et mandats attribués aux enseignants"""
teacher = models.ForeignKey(Teacher, blank=True, null=True,
verbose_name="Enseignant-e", on_delete=models.SET_NULL)
+
public = models.CharField("Classe(s)", max_length=200, default='')
subject = models.CharField("Sujet", max_length=100, default='')
period = models.IntegerField("Nb de périodes", default=0)
@@ -419,6 +421,7 @@ class Course(models.Model):
self.teacher, self.public, self.subject, self.period
)
+
GENDER_CHOICES = (
('M', 'Masculin'),
('F', 'Féminin'),
@@ -481,6 +484,7 @@ class Candidate(models.Model):
email = models.EmailField(verbose_name='Courriel', blank=True)
avs = models.CharField(max_length=15, blank=True, verbose_name='No AVS')
handicap = models.BooleanField(default=False)
+
section = models.CharField(max_length=10, choices=SECTION_CHOICES, null=False, verbose_name='Filière')
option = models.CharField(max_length=20, choices=OPTION_CHOICES, null=True, blank=True)
exemption_ecg = models.BooleanField(default=False)
@@ -489,6 +493,7 @@ class Candidate(models.Model):
date_confirmation_mail = models.DateField(default=None, blank=True, null=True, verbose_name='Mail de confirmation')
canceled_file = models.BooleanField(default=False, verbose_name='Dossier retiré')
photo = models.BooleanField(default=False)
+
corporation = models.ForeignKey('Corporation', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='Employeur')
instructor = models.ForeignKey('CorpContact', null=True, blank=True,
@@ -517,6 +522,7 @@ class Candidate(models.Model):
file_result = models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Points dossier')
total_result_points = models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Total points')
total_result_mark = models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='Note finale')
+
accepted = models.BooleanField(default=False, verbose_name='Admis')
interview_resp = models.ForeignKey(Teacher, default=None, null=True, blank=True, verbose_name='Exp. entretien')
file_resp = models.ForeignKey(Teacher, default=None, related_name='rel_file_exp', null=True,