Fix student import test on PostgreSQL
This commit is contained in:
parent
1e974c1865
commit
922acea79b
3 changed files with 20 additions and 2 deletions
16
stages/migrations/0005_extend_student_avs.py
Normal file
16
stages/migrations/0005_extend_student_avs.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0004_add_student_report_fields'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='student',
|
||||
name='avs',
|
||||
field=models.CharField(blank=True, max_length=20, verbose_name='No AVS'),
|
||||
),
|
||||
]
|
||||
|
|
@ -169,7 +169,7 @@ class Student(models.Model):
|
|||
tel = models.CharField(max_length=40, blank=True, verbose_name='Téléphone')
|
||||
mobile = models.CharField(max_length=40, blank=True, verbose_name='Portable')
|
||||
email = models.EmailField(verbose_name='Courriel', blank=True)
|
||||
avs = models.CharField(max_length=15, blank=True, verbose_name='No AVS')
|
||||
avs = models.CharField(max_length=20, blank=True, verbose_name='No AVS')
|
||||
option_ase = models.ForeignKey(Option, null=True, blank=True, on_delete=models.SET_NULL)
|
||||
dispense_ecg = models.BooleanField(default=False)
|
||||
dispense_eps = models.BooleanField(default=False)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from django.conf import settings
|
|||
from django.contrib import messages
|
||||
from django.core.files import File
|
||||
from django.core.mail import EmailMessage
|
||||
from django.db import transaction
|
||||
from django.db.models import Case, Count, Value, When, Q
|
||||
from django.db.models.functions import Concat
|
||||
from django.http import HttpResponse, HttpResponseNotAllowed, HttpResponseRedirect
|
||||
|
|
@ -289,7 +290,8 @@ class ImportViewBase(FormView):
|
|||
imp_file = CSVImportedFile(File(upfile))
|
||||
else:
|
||||
imp_file = FileFactory(upfile)
|
||||
stats = self.import_data(imp_file)
|
||||
with transaction.atomic():
|
||||
stats = self.import_data(imp_file)
|
||||
except Exception as e:
|
||||
if settings.DEBUG:
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue