From f2068a1ecb8ae4820c26fbad08c22cb170d83ce3 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Sat, 30 May 2020 01:38:49 +0200 Subject: [PATCH] ajout de code_ape, sauf pour les CSV de 26 colonnes --- .../migrations/0007_entreprise_code_ape.py | 20 +++++++++++++++++++ passerelle_reunion_fsn/models.py | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 passerelle_reunion_fsn/migrations/0007_entreprise_code_ape.py diff --git a/passerelle_reunion_fsn/migrations/0007_entreprise_code_ape.py b/passerelle_reunion_fsn/migrations/0007_entreprise_code_ape.py new file mode 100644 index 0000000..f027d2a --- /dev/null +++ b/passerelle_reunion_fsn/migrations/0007_entreprise_code_ape.py @@ -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), + ), + ] diff --git a/passerelle_reunion_fsn/models.py b/passerelle_reunion_fsn/models.py index 0b6437f..63d7fcb 100644 --- a/passerelle_reunion_fsn/models.py +++ b/passerelle_reunion_fsn/models.py @@ -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]