From 5a963eb2810fcc5919793231ace93f75d5f77880 Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Tue, 25 Feb 2020 14:18:39 +0100 Subject: [PATCH] add support for last_negative field --- management/commands/import_nk15.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/management/commands/import_nk15.py b/management/commands/import_nk15.py index 10218c2..295b332 100644 --- a/management/commands/import_nk15.py +++ b/management/commands/import_nk15.py @@ -10,6 +10,8 @@ from django.db import transaction import collections from django.core.exceptions import ValidationError +from django.utils.timezone import make_aware + from django.db import IntegrityError from django.contrib.auth.models import User from note.models import Note, NoteSpecial, NoteUser, NoteClub @@ -101,6 +103,9 @@ def import_comptes(cur,map_idbde): } profile = Profile.objects.create(**obj_dict) note = user.note + date = row.get("last_negatif",None) + if date != None: + note.last_negative = make_aware(date) note.balance = row["solde"] obj_list =[user, profile, note] else: # club