diff --git a/README.md b/README.md index 01f4ead2..4feb4e58 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,11 @@ Vous pouvez maintenant installer les dépendances Python depuis le fichier pip install -U pip pip install -r requirements-devel.txt -Pour terminer, copier le fichier `cof/settings/secret_example.py` vers -`cof/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien symbolique -pour profiter de façon transparente des mises à jour du fichier: +Pour terminer, copier le fichier `gestioCOF/settings/secret_example.py` vers +`gestioCOF/settings/secret.py`. Sous Linux ou Mac, préférez plutôt un lien +symbolique pour profiter de façon transparente des mises à jour du fichier: - ln -s secret_example.py cof/settings/secret.py + ln -s secret_example.py gestioCOF/settings/secret.py #### Fin d'installation diff --git a/cof/management/commands/check_olddata.py b/cof/management/commands/check_olddata.py index 8fdac0e4..dc1ccd47 100644 --- a/cof/management/commands/check_olddata.py +++ b/cof/management/commands/check_olddata.py @@ -31,21 +31,21 @@ class Command(BaseCommand): def check_users(self): self.stdout.write("* Utilisateurs... ", ending='') - self.u1 = User.objects.get(username='user1') + self.u1 = User.objects.get(username='cbds_user1') assert self.u1.profile.login_clipper == 'user1' assert self.g_staff in self.u1.groups.all() assert self.g_members in self.u1.groups.all() assert self.u1.has_perm('cof.buro') assert self.u1.has_perm('cof.member') - self.u2 = User.objects.get(username='user2') + self.u2 = User.objects.get(username='cbds_user2') assert self.u2.profile.login_clipper == 'user2' assert self.g_staff not in self.u2.groups.all() assert self.g_members in self.u2.groups.all() assert not self.u2.has_perm('cof.buro') assert self.u2.has_perm('cof.member') - self.u3 = User.objects.get(username='user3') + self.u3 = User.objects.get(username='cbds_user3') assert self.u3.profile.login_clipper == 'user3' assert self.g_staff not in self.u3.groups.all() assert self.g_members not in self.u3.groups.all() diff --git a/cof/migrations/0008_py3.py b/cof/migrations/0008_py3.py index 99aa2f9f..b758e996 100644 --- a/cof/migrations/0008_py3.py +++ b/cof/migrations/0008_py3.py @@ -34,13 +34,13 @@ def load_olddata(apps, schema_editor): ) # Setup users. - u1 = load_user(apps, 'user1', is_cof=True) + u1 = load_user(apps, 'cbds_user1', is_cof=True) u1.profile.is_buro = True u1.profile.save() - u2 = load_user(apps, 'user2', is_cof=True) + u2 = load_user(apps, 'cbds_user2', is_cof=True) - u3 = load_user(apps, 'user3') + u3 = load_user(apps, 'cbds_user3') # Setup clubs. Club = apps.get_model('cof', 'Club') diff --git a/cof/migrations/0014_move_profile.py b/cof/migrations/0014_move_profile.py index 344b512c..52e537eb 100644 --- a/cof/migrations/0014_move_profile.py +++ b/cof/migrations/0014_move_profile.py @@ -4,11 +4,15 @@ from __future__ import unicode_literals from django.db import migrations, models from django.db.models import F +from utils.models import sqlsequencereset + def profiles_to_gestion(apps, schema_editor): OldProfile = apps.get_model('cof', 'CofProfile') NewProfile = apps.get_model('gestion', 'Profile') + connection = schema_editor.connection + # New profiles are massively imported from the old profiles. # IDs are kept identical to ease the migration of models which were # referencing the CofProfile model. @@ -30,6 +34,8 @@ def profiles_to_gestion(apps, schema_editor): NewProfile.objects.bulk_create(new_profiles) + sqlsequencereset([NewProfile], conn=connection) + OldProfile.objects.all().update(profile_id=F('id')) diff --git a/cof/migrations/0016_move_event.py b/cof/migrations/0016_move_event.py index 60e1bbf5..033bf3a7 100644 --- a/cof/migrations/0016_move_event.py +++ b/cof/migrations/0016_move_event.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals from django.db import migrations +from utils.models import sqlsequencereset + def event_to_gestion(apps, schema_editor): # Fetching the models that have be moved from cof to gestion @@ -11,6 +13,8 @@ def event_to_gestion(apps, schema_editor): Location = apps.get_model('gestion', 'Location') Association = apps.get_model('gestion', 'Association') + connection = schema_editor.connection + # The old Event.location field becomes a table: we need to create an entry # in this table for each value of the old `location` field. locations = set() # A set to prevent duplicate entries @@ -31,6 +35,8 @@ def event_to_gestion(apps, schema_editor): for event in new_events ]) + sqlsequencereset([NewEvent], conn=connection) + # Do not forget to link all the existing event to the COF association cof_assoc = Association.objects.get(name="COF") cof_assoc.events.add(*NewEvent.objects.all()) @@ -57,6 +63,7 @@ def event_to_gestion(apps, schema_editor): ToModel(**values) for values in FromModel.objects.values() ]) + sqlsequencereset([ToModel], conn=connection) class Migration(migrations.Migration): diff --git a/gestioCOF/asgi.py b/gestioCOF/asgi.py index a34621c7..5d271a25 100644 --- a/gestioCOF/asgi.py +++ b/gestioCOF/asgi.py @@ -2,6 +2,6 @@ import os from channels.asgi import get_channel_layer if "DJANGO_SETTINGS_MODULE" not in os.environ: - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cof.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gestioCOF.settings.local") channel_layer = get_channel_layer() diff --git a/provisioning/bootstrap.sh b/provisioning/bootstrap.sh index 69bbcf4c..7b19c475 100644 --- a/provisioning/bootstrap.sh +++ b/provisioning/bootstrap.sh @@ -41,11 +41,11 @@ sudo -H -u ubuntu ~ubuntu/venv/bin/pip install -r /vagrant/requirements-devel.tx # Préparation de Django cd /vagrant -ln -s -f secret_example.py cof/settings/secret.py +ln -s -f secret_example.py gestioCOF/settings/secret.py sudo -H -u ubuntu \ - DJANGO_SETTINGS_MODULE='cof.settings.dev' \ + DJANGO_SETTINGS_MODULE='gestioCOF.settings.dev' \ bash -c ". ~/venv/bin/activate && bash provisioning/prepare_django.sh" -/home/ubuntu/venv/bin/python manage.py collectstatic --noinput --settings cof.settings.dev +/home/ubuntu/venv/bin/python manage.py collectstatic --noinput --settings gestioCOF.settings.dev # Installation du cron pour les mails de rappels sudo -H -u ubuntu crontab provisioning/cron.dev @@ -61,7 +61,7 @@ systemctl start worker.service # Mise en place du .bash_profile pour tout configurer lors du `vagrant ssh` cat >> ~ubuntu/.bashrc <