code cleaning

This commit is contained in:
Pierre-antoine Comby 2020-05-21 18:28:38 +02:00
parent 11e6bd9720
commit 996ac3c337
2 changed files with 5 additions and 6 deletions

View File

@ -10,7 +10,6 @@ from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from django.db import IntegrityError
from note.models import Note, NoteUser, NoteClub
from note.models import Alias
@ -41,10 +40,10 @@ class Command(ImportCommand):
"""
Import command for People base data (Comptes, and Aliases)
"""
def add_arguments(self, parser):
parser.add_argument('-a', '--alias', action='store_true', help="import alias")
@transaction.atomic
def import_account(self, cur, chunk_size):
"""
@ -56,7 +55,7 @@ class Command(ImportCommand):
pk_club = 3
pk_user = 1
pk_profile = 1
pk_note = 7 # pk 6 is Kfet!
pk_note = 7 # pk 6 is Kfet!
n = cur.rowcount
bulk_mgr = BulkCreateManager(chunk_size=chunk_size)

View File

@ -333,7 +333,7 @@ def import_activities(cur):
update_line(idx, n, row["alias"])
organizer = Club.objects.filter(name=row["signature"])
if organizer.exists():
# Try to find the club that organizes the activity. If not founded, assume it's Kfet (fix manually)
# Try to find the club that organizes the activity. If not found, assume it's Kfet (fix manually)
organizer = organizer.get()
else:
organizer = kfet
@ -347,7 +347,7 @@ def import_activities(cur):
"date_start": row["debut"],
"date_end": row["fin"],
"valid": row["validepar"] is not None,
"open": row["open"], # Should be always False
"open": row["open"], # Should always be False
}
# WARNING: Fields lieu, liste, listeimprimee are missing
try: