You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
558 B
18 lines
558 B
from django.core.management.base import BaseCommand |
|
from csv import DictReader |
|
from quiz_atomes.models import User |
|
|
|
class Command(BaseCommand): |
|
# Show this when the user types help |
|
help = "Chargement des comptes depuis login.csv" |
|
|
|
def handle(self, *args, **options): |
|
|
|
if User.objects.exists(): |
|
print('Données déjà présentes') |
|
return |
|
|
|
print("Chargement des comptes") |
|
|
|
for row in DictReader(open('./quiz_atomes/data/login.csv')): |
|
User(login=row['login']).save()
|
|
|