Add Student.instructor2 relation

This commit is contained in:
Claude Paroz 2020-09-11 11:42:24 +02:00
parent cbbcc2c5ca
commit 20b8459a6b
4 changed files with 26 additions and 2 deletions

View file

@ -161,7 +161,7 @@ class StudentAdmin(admin.ModelAdmin):
ordering = ('last_name', 'first_name')
list_filter = (('archived', ArchivedListFilter), ('klass', KlassRelatedListFilter))
search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass__name')
autocomplete_fields = ('corporation', 'instructor', 'supervisor', 'mentor')
autocomplete_fields = ('corporation', 'instructor', 'instructor2', 'supervisor', 'mentor')
readonly_fields = ('report_sem1_sent', 'report_sem2_sent', 'mentor_indemn')
fieldsets = [
(None, {
@ -172,7 +172,7 @@ class StudentAdmin(admin.ModelAdmin):
('klass', 'option_ase'),
('report_sem1', 'report_sem1_sent'),
('report_sem2', 'report_sem2_sent'),
('corporation', 'instructor',)
('corporation', 'instructor', 'instructor2')
)}
),
("Procédure de qualification", {

View file

@ -0,0 +1,16 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stages', '0033_room_length'),
]
operations = [
migrations.AddField(
model_name='student',
name='instructor2',
field=models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, related_name='rel_instructor2', to='stages.CorpContact', verbose_name='FEE/FPP (2)'),
),
]

View file

@ -293,6 +293,8 @@ class Student(models.Model):
on_delete=models.SET_NULL, verbose_name='Employeur')
instructor = models.ForeignKey('CorpContact', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='FEE/FPP')
instructor2 = models.ForeignKey('CorpContact', null=True, blank=True, related_name='rel_instructor2',
on_delete=models.SET_NULL, verbose_name='FEE/FPP (2)')
supervisor = models.ForeignKey('CorpContact', related_name='rel_supervisor', verbose_name='Superviseur',
null=True, blank=True, on_delete=models.SET_NULL)
supervision_attest_received = models.BooleanField('Attest. supervision reçue',

View file

@ -326,6 +326,12 @@ GENERAL_EXPORT_FIELDS = [
('Nom_Form', 'instructor__last_name'),
('Tel_Form', 'instructor__tel'),
('Email_Form', 'instructor__email'),
('Num_Form2', 'instructor2__ext_id'),
('Titre_Form2', 'instructor2__civility'),
('Prenom_Form2', 'instructor2__first_name'),
('Nom_Form2', 'instructor2__last_name'),
('Tel_Form2', 'instructor2__tel'),
('Email_Form2', 'instructor2__email'),
('EmailCopie_Form', None),
]