Add a fixture with 2 events for testing purpose

This commit is contained in:
Martin Pépin 2017-06-25 20:17:16 +01:00
parent 7633ed1dab
commit 894c70149c
4 changed files with 209 additions and 13 deletions

View file

@ -0,0 +1,193 @@
[
{
"model": "gestion.location",
"pk": 1,
"fields": {
"name": "Gergovie"
}
},
{
"model": "gestion.location",
"pk": 2,
"fields": {
"name": "Lut\u00e8ce"
}
},
{
"model": "gestion.event",
"pk": 1,
"fields": {
"title": "Bataille de gergovie",
"location": 1,
"start_date": "2017-06-25T18:00:00Z",
"end_date": "2017-06-27T18:00:00Z",
"description": "Bataille historique \u00e0 ne pas manquer.\r\nOpen sanglier \u00e0 la fin.",
"image": "",
"registration_open": true,
"old": false,
"associations": [
"COF"
]
}
},
{
"model": "gestion.event",
"pk": 2,
"fields": {
"title": "Course de chars",
"location": 2,
"start_date": "2017-06-25T13:00:00Z",
"end_date": "2017-06-25T16:00:00Z",
"description": "Finale de la league nationale de char \u00e0 b\u0153ufs",
"image": "",
"registration_open": true,
"old": false,
"associations": [
"BDS"
]
}
},
{
"model": "gestion.eventcommentfield",
"pk": 1,
"fields": {
"event": 1,
"name": "Commentaires",
"fieldtype": "text",
"default": "",
"ordering": 0
}
},
{
"model": "gestion.eventoption",
"pk": 1,
"fields": {
"event": 1,
"name": "Potion magique",
"multi_choices": false
}
},
{
"model": "gestion.eventoption",
"pk": 2,
"fields": {
"event": 1,
"name": "Extras pendant le buffet",
"multi_choices": true
}
},
{
"model": "gestion.eventoption",
"pk": 3,
"fields": {
"event": 2,
"name": "Type de si\u00e8ge",
"multi_choices": false
}
},
{
"model": "gestion.eventoption",
"pk": 4,
"fields": {
"event": 2,
"name": "Forfaits suppl\u00e9mentaires",
"multi_choices": true
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 1,
"fields": {
"event_option": 1,
"value": "Oui"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 2,
"fields": {
"event_option": 1,
"value": "Non"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 3,
"fields": {
"event_option": 1,
"value": "Je suis tomb\u00e9 dans la marmitte quand j'\u00e9tais petit"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 4,
"fields": {
"event_option": 2,
"value": "Sanglier"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 5,
"fields": {
"event_option": 2,
"value": "Cervoise"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 6,
"fields": {
"event_option": 2,
"value": "Pot\u00e9e auvergnate"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 7,
"fields": {
"event_option": 2,
"value": "Saint Nectaire"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 8,
"fields": {
"event_option": 3,
"value": "Debout"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 9,
"fields": {
"event_option": 3,
"value": "Assis standard"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 10,
"fields": {
"event_option": 3,
"value": "Premier rang"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 11,
"fields": {
"event_option": 4,
"value": "Popcorn"
}
},
{
"model": "gestion.eventoptionchoice",
"pk": 12,
"fields": {
"event_option": 4,
"value": "Coussin moelleux"
}
}
]

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-06-24 21:21
# Generated by Django 1.11b1 on 2017-06-25 17:21
from __future__ import unicode_literals
from django.db import migrations, models
@ -16,8 +16,8 @@ def create_apps(apps, schema_editor):
bds_b, _ = Group.objects.get_or_create(name="bds_buro")
Association.objects.bulk_create([
Association(id=1, name="COF", staff_group=cof_b, members_group=cof_m),
Association(id=2, name="BDS", staff_group=bds_b, members_group=bds_m),
Association(name="COF", staff_group=cof_b, members_group=cof_m),
Association(name="BDS", staff_group=bds_b, members_group=bds_m),
])
@ -32,8 +32,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Association',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30, verbose_name="nom de l'association")),
('name', models.CharField(max_length=30, primary_key=True, serialize=False, verbose_name="nom de l'association")),
('members_group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='member_groups', to='auth.Group', verbose_name='groupe des membres')),
('staff_group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='staff_groups', to='auth.Group', verbose_name='groupe des membre du bureau')),
],
@ -47,15 +46,15 @@ class Migration(migrations.Migration):
model_name='club',
name='associations',
),
migrations.AddField(
model_name='club',
name='association',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, related_name='clubs', to='gestion.Association', verbose_name='association'),
preserve_default=False,
),
migrations.AlterField(
model_name='event',
name='associations',
field=models.ManyToManyField(related_name='events', to='gestion.Association', verbose_name='associations'),
),
migrations.AddField(
model_name='club',
name='association',
field=models.ForeignKey(default="COF", on_delete=django.db.models.deletion.PROTECT, related_name='clubs', to='gestion.Association', verbose_name='association'),
preserve_default=False,
),
]

View file

@ -67,7 +67,11 @@ def post_delete_user(sender, instance, *args, **kwargs):
class Association(models.Model):
name = models.CharField(_("nom de l'association"), max_length=30)
name = models.CharField(
_("nom de l'association"),
primary_key=True,
max_length=30
)
staff_group = models.ForeignKey(
Group,
on_delete=models.PROTECT,

View file

@ -3,7 +3,7 @@
source ~/venv/bin/activate
python manage.py migrate
python manage.py loaddata gestion sites articles
python manage.py loaddata gestion events sites articles
python manage.py loaddevdata
python manage.py syncmails
python manage.py collectstatic --noinput