mirror of
				https://gitlab.crans.org/bde/nk20-scripts
				synced 2025-10-30 22:59:52 +01:00 
			
		
		
		
	code cleaning
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user