Report error when NoSIRET column is empty in HPContactsImportView
This commit is contained in:
parent
b81d7db5b3
commit
c86128250e
3 changed files with 11 additions and 1 deletions
|
|
@ -457,7 +457,7 @@ class HPContactsImportView(ImportViewBase):
|
|||
def import_data(self, up_file):
|
||||
obj_modified = 0
|
||||
errors = []
|
||||
for line in up_file:
|
||||
for idx, line in enumerate(up_file, start=2):
|
||||
try:
|
||||
student = Student.objects.get(ext_id=int(line['UID_ETU']))
|
||||
except Student.DoesNotExist:
|
||||
|
|
@ -465,6 +465,11 @@ class HPContactsImportView(ImportViewBase):
|
|||
"Impossible de trouver l'étudiant avec le numéro %s" % int(line['UID_ETU'])
|
||||
)
|
||||
continue
|
||||
if not line['NoSIRET']:
|
||||
errors.append(
|
||||
"NoSIRET est vide à ligne %d. Ligne ignorée" % idx
|
||||
)
|
||||
continue
|
||||
try:
|
||||
corp = Corporation.objects.get(ext_id=int(line['NoSIRET']))
|
||||
except Corporation.DoesNotExist:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue