ajout de code_ape, sauf pour les CSV de 26 colonnes
This commit is contained in:
parent
247ccbd2b3
commit
f2068a1ecb
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.18 on 2020-05-29 23:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('passerelle_reunion_fsn', '0006_auto_20200519_1158'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='entreprise',
|
||||
name='code_ape',
|
||||
field=models.CharField(blank=True, max_length=10),
|
||||
),
|
||||
]
|
|
@ -90,6 +90,7 @@ COLUMNS_KEYNAMES = [
|
|||
'prenom_demandeur',
|
||||
'qualite',
|
||||
'tel',
|
||||
'code_ape',
|
||||
'courriel',
|
||||
]
|
||||
|
||||
|
@ -755,6 +756,7 @@ class Entreprise(models.Model):
|
|||
prenom_demandeur = models.CharField(max_length=35, blank=True)
|
||||
qualite = models.CharField(max_length=35, blank=True)
|
||||
tel = models.CharField(max_length=30, blank=True)
|
||||
code_ape = models.CharField(max_length=10, blank=True)
|
||||
courriel = models.CharField(max_length=241, blank=True)
|
||||
last_update_datetime = models.DateTimeField(auto_now=True)
|
||||
|
||||
|
@ -811,6 +813,8 @@ class DSDossier(models.Model):
|
|||
|
||||
rows = [[smart_text(x) for x in y] for y in rows if y]
|
||||
titles = [t.strip() for t in COLUMNS_KEYNAMES]
|
||||
if len(rows[0]) == 26: # CSV file without "code_ape"
|
||||
titles.pop(titles.index('code_ape'))
|
||||
indexes = [titles.index(t) for t in titles if t]
|
||||
caption = [titles[i] for i in indexes]
|
||||
|
||||
|
|
Reference in New Issue