Fix the loaddevdata script
This commit is contained in:
parent
f0c3def935
commit
6c3e1bd2db
2 changed files with 12 additions and 6 deletions
|
@ -77,7 +77,7 @@ class Command(MyBaseCommand):
|
|||
self.stdout.write("Inscription des utilisateurs aux tirages")
|
||||
ChoixSpectacle.objects.all().delete()
|
||||
choices = []
|
||||
for user in User.objects.filter(profile__is_cof=True):
|
||||
for user in User.objects.filter(profile__cof__is_cof=True):
|
||||
for tirage in tirages:
|
||||
part, _ = Participant.objects.get_or_create(
|
||||
user=user,
|
||||
|
|
|
@ -19,6 +19,8 @@ from cof.petits_cours_models import (
|
|||
PetitCoursAttributionCounter
|
||||
)
|
||||
|
||||
from cof.models import CofProfile
|
||||
|
||||
# Où sont stockés les fichiers json
|
||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
'data')
|
||||
|
@ -47,8 +49,10 @@ class Command(MyBaseCommand):
|
|||
# Gaulois
|
||||
gaulois = self.from_json('gaulois.json', DATA_DIR, User)
|
||||
for user in gaulois:
|
||||
user.profile.is_cof = True
|
||||
user.profile.save()
|
||||
CofProfile.objects.create(
|
||||
profile=user.profile,
|
||||
is_cof=True
|
||||
)
|
||||
|
||||
# Romains
|
||||
self.from_json('romains.json', DATA_DIR, User)
|
||||
|
@ -65,10 +69,12 @@ class Command(MyBaseCommand):
|
|||
root.set_password('root')
|
||||
root.is_staff = True
|
||||
root.is_superuser = True
|
||||
root.profile.is_cof = True
|
||||
root.profile.is_buro = True
|
||||
root.profile.save()
|
||||
root.save()
|
||||
CofProfile.objects.create(
|
||||
profile=root.profile,
|
||||
is_cof=True,
|
||||
is_buro=True
|
||||
)
|
||||
|
||||
# ---
|
||||
# Petits cours
|
||||
|
|
Loading…
Reference in a new issue