1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 09:18:23 +02:00

Display teams

This commit is contained in:
Yohann D'ANELLO
2020-04-29 16:59:59 +02:00
parent e865910ee3
commit f57d7554e7
7 changed files with 139 additions and 7 deletions

View File

@ -166,6 +166,25 @@ class Command(BaseCommand):
TFJMUser.objects.create(**obj_dict)
self.stdout.write(self.style.SUCCESS("Users imported"))
self.stdout.write("Importing organizers...")
with open("import_olddb/organizers.csv") as f:
first_line = True
for line in f:
if first_line:
first_line = False
continue
line = line[:-1].replace("\"", "")
args = line.split(";")
args = [arg if arg and arg != "NULL" else None for arg in args]
with transaction.atomic():
tournament = Tournament.objects.get(pk=args[2])
organizer = TFJMUser.objects.get(pk=args[1])
tournament.organizers.add(organizer)
tournament.save()
self.stdout.write(self.style.SUCCESS("Organizers imported"))
@transaction.atomic
def import_documents(self):
self.stdout.write("Importing documents...")

9
apps/member/tables.py Normal file
View File

@ -0,0 +1,9 @@
import django_tables2 as tables
from member.models import TFJMUser
class UserTable(tables.Table):
class Meta:
model = TFJMUser
fields = ("last_name", "first_name", "role",)