adapt migrations and tests
This commit is contained in:
parent
4e8873226f
commit
270e31f12b
6 changed files with 92 additions and 37 deletions
46
communication/migrations/0001_initial.py
Normal file
46
communication/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.3 on 2017-07-18 13:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
('auth', '0008_alter_user_username_max_length'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='GroupSubscription',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('object_id', models.PositiveIntegerField()),
|
||||
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
|
||||
('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auth.Group')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'souscription en groupe',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='UserSubscription',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('object_id', models.PositiveIntegerField()),
|
||||
('is_unsub', models.BooleanField(default=False, verbose_name='désinscription')),
|
||||
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'souscription utilisateur',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-21 20:14
|
||||
# Generated by Django 1.11.3 on 2017-07-18 13:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
@ -19,9 +19,9 @@ class Migration(migrations.Migration):
|
|||
name='AbstractEquipment',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=200, verbose_name='Nom du matériel')),
|
||||
('stock', models.PositiveSmallIntegerField(verbose_name='Quantité disponible')),
|
||||
('description', models.TextField(verbose_name='Description')),
|
||||
('name', models.CharField(max_length=200, verbose_name='nom du matériel')),
|
||||
('stock', models.PositiveSmallIntegerField(verbose_name='quantité disponible')),
|
||||
('description', models.TextField(verbose_name='description')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'matériel abstrait',
|
||||
|
@ -32,8 +32,8 @@ class Migration(migrations.Migration):
|
|||
name='EquipmentAttribution',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('amount', models.PositiveSmallIntegerField(verbose_name='Quantité attribuée')),
|
||||
('remarks', models.TextField(verbose_name="Remarques concernant l'attribution")),
|
||||
('amount', models.PositiveSmallIntegerField(verbose_name='quantité attribuée')),
|
||||
('remarks', models.TextField(verbose_name="remarques concernant l'attribution")),
|
||||
('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='event.Activity')),
|
||||
],
|
||||
options={
|
||||
|
@ -45,7 +45,8 @@ class Migration(migrations.Migration):
|
|||
name='EquipmentRemark',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('remark', models.TextField(verbose_name='Remarque sur le matériel')),
|
||||
('remark', models.TextField(verbose_name='remarque sur le matériel')),
|
||||
('amount', models.PositiveSmallIntegerField(verbose_name='quantité concernée')),
|
||||
('is_broken', models.BooleanField()),
|
||||
('is_lost', models.BooleanField()),
|
||||
],
|
||||
|
|
|
@ -12,7 +12,7 @@ urlpatterns = [
|
|||
url(r'^', include('shared.urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
urlpatterns += [
|
||||
url(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-21 20:14
|
||||
# Generated by Django 1.11.3 on 2017-07-18 13:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -21,68 +21,71 @@ class Migration(migrations.Migration):
|
|||
name='ActivityTag',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=200, verbose_name='Nom du tag')),
|
||||
('name', models.CharField(max_length=200, verbose_name='nom du tag')),
|
||||
('is_public', models.BooleanField(help_text="Sert à faire une distinction dans l'affichage selon que cela soit destiné au public ou à l'équipe organisatrice")),
|
||||
('color', models.CharField(help_text='Rentrer une couleur en hexadécimal', max_length=7, validators=[django.core.validators.RegexValidator(message="La chaîne de caractère rentrée n'est pasune couleur en hexadécimal.", regex='^#(?:[0-9a-fA-F]{3}){1,2}$')], verbose_name='Couleur')),
|
||||
('color', models.CharField(help_text='Rentrer une couleur en hexadécimal', max_length=7, validators=[django.core.validators.RegexValidator(message="La chaîne de caractère rentrée n'est pas une couleur en hexadécimal.", regex='^#(?:[0-9a-fA-F]{3}){1,2}$')], verbose_name='couleur')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'tag',
|
||||
'verbose_name_plural': 'tags',
|
||||
'verbose_name': 'tag',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ActivityTemplate',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(blank=True, max_length=200, null=True, verbose_name="Nom de l'activité")),
|
||||
('title', models.CharField(blank=True, max_length=200, null=True, verbose_name="nom de l'activité")),
|
||||
('is_public', models.NullBooleanField()),
|
||||
('has_perm', models.NullBooleanField()),
|
||||
('min_perm', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='Nombre minimum de permanents')),
|
||||
('max_perm', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='Nombre maximum de permanents')),
|
||||
('description', models.TextField(blank=True, help_text='Public, Visible par tout le monde.', null=True, verbose_name='Description')),
|
||||
('remarks', models.TextField(blank=True, help_text='Visible uniquement par les organisateurs', null=True, verbose_name='Remarques')),
|
||||
('min_perm', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='nombre minimum de permanents')),
|
||||
('max_perm', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='nombre maximum de permanents')),
|
||||
('description', models.TextField(blank=True, help_text='Public, Visible par tout le monde.', null=True, verbose_name='description')),
|
||||
('remarks', models.TextField(blank=True, help_text='Visible uniquement par les organisateurs', null=True, verbose_name='remarques')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'template activité',
|
||||
'verbose_name_plural': 'templates activité',
|
||||
'verbose_name': 'template activité',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Event',
|
||||
fields=[
|
||||
('title', models.CharField(max_length=200, verbose_name="Nom de l'évènement")),
|
||||
('slug', models.SlugField(help_text="Seulement des lettres, des chiffres oules caractères '_' ou '-'.", primary_key=True, serialize=False, unique=True, verbose_name='Identificateur')),
|
||||
('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Date de création')),
|
||||
('description', models.TextField(verbose_name='Description')),
|
||||
('beginning_date', models.DateTimeField(verbose_name='Date de début')),
|
||||
('ending_date', models.DateTimeField(verbose_name='Date de fin')),
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200, verbose_name="nom de l'évènement")),
|
||||
('slug', models.SlugField(help_text="Seulement des lettres, des chiffres oules caractères '_' ou '-'.", unique=True, verbose_name='identificateur')),
|
||||
('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='date de création')),
|
||||
('description', models.TextField(verbose_name='description')),
|
||||
('beginning_date', models.DateTimeField(verbose_name='date de début')),
|
||||
('ending_date', models.DateTimeField(blank=True, null=True, verbose_name='date de fin')),
|
||||
('created_by', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='created_events', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'évènement',
|
||||
'verbose_name_plural': 'évènements',
|
||||
'verbose_name': 'évènement',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Place',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=200, verbose_name='Nom du lieu')),
|
||||
('name', models.CharField(max_length=200, verbose_name='nom du lieu')),
|
||||
('description', models.TextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'lieu',
|
||||
'verbose_name_plural': 'lieux',
|
||||
'verbose_name': 'lieu',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Activity',
|
||||
fields=[
|
||||
('activitytemplate_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='event.ActivityTemplate')),
|
||||
('beginning', models.DateTimeField(verbose_name='heure de début')),
|
||||
('end', models.DateTimeField(verbose_name='heure de fin')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'activité',
|
||||
'verbose_name_plural': 'activités',
|
||||
'verbose_name': 'activité',
|
||||
},
|
||||
bases=('event.activitytemplate',),
|
||||
),
|
||||
|
|
|
@ -44,51 +44,56 @@ class ActivityInheritanceTest(TestCase):
|
|||
self.template_act = ActivityTemplate.objects.create()
|
||||
self.real_act = Activity.objects.create(
|
||||
parent=self.template_act,
|
||||
beginning=timezone.now()
|
||||
+ timedelta(days=30),
|
||||
end=timezone.now()
|
||||
+ timedelta(days=30)
|
||||
+ timedelta(hours=2),
|
||||
)
|
||||
|
||||
def test_inherites_title(self):
|
||||
def test_inherits_title(self):
|
||||
self.template_act.title = "parent"
|
||||
self.assertEqual(self.real_act.get_herited('title'), "parent")
|
||||
self.real_act.title = "enfant"
|
||||
self.assertEqual(self.real_act.get_herited('title'), "enfant")
|
||||
|
||||
def test_inherites_description(self):
|
||||
def test_inherits_description(self):
|
||||
self.template_act.description = "parent"
|
||||
self.assertEqual(self.real_act.get_herited('description'), "parent")
|
||||
self.real_act.description = "enfant"
|
||||
self.assertEqual(self.real_act.get_herited('description'), "enfant")
|
||||
|
||||
def test_inherites_remarks(self):
|
||||
def test_inherits_remarks(self):
|
||||
self.template_act.remarks = "parent"
|
||||
self.assertEqual(self.real_act.get_herited('remarks'), "parent")
|
||||
self.real_act.remarks = "enfant"
|
||||
self.assertEqual(self.real_act.get_herited('remarks'), "enfant")
|
||||
|
||||
def test_inherites_is_public(self):
|
||||
def test_inherits_is_public(self):
|
||||
self.template_act.is_public = True
|
||||
self.assertEqual(self.real_act.get_herited('is_public'), True)
|
||||
self.real_act.is_public = False
|
||||
self.assertEqual(self.real_act.get_herited('is_public'), False)
|
||||
|
||||
def test_inherites_has_perm(self):
|
||||
def test_inherits_has_perm(self):
|
||||
self.template_act.has_perm = True
|
||||
self.assertEqual(self.real_act.get_herited('has_perm'), True)
|
||||
self.real_act.has_perm = False
|
||||
self.assertEqual(self.real_act.get_herited('has_perm'), False)
|
||||
|
||||
def test_inherites_min_perm(self):
|
||||
def test_inherits_min_perm(self):
|
||||
self.template_act.min_perm = 42
|
||||
self.assertEqual(self.real_act.get_herited('min_perm'), 42)
|
||||
self.real_act.min_perm = 1
|
||||
self.assertEqual(self.real_act.get_herited('min_perm'), 1)
|
||||
|
||||
def test_inherites_max_perm(self):
|
||||
def test_inherits_max_perm(self):
|
||||
self.template_act.max_perm = 42
|
||||
self.assertEqual(self.real_act.get_herited('max_perm'), 42)
|
||||
self.real_act.max_perm = 1
|
||||
self.assertEqual(self.real_act.get_herited('max_perm'), 1)
|
||||
|
||||
def test_inherites_place(self):
|
||||
def test_inherits_place(self):
|
||||
self.template_act.place.add(self.loge)
|
||||
self.assertEqual(
|
||||
self.real_act.get_herited('place').get(),
|
||||
|
@ -100,7 +105,7 @@ class ActivityInheritanceTest(TestCase):
|
|||
self.aqua
|
||||
)
|
||||
|
||||
def test_inherites_tags(self):
|
||||
def test_inherits_tags(self):
|
||||
self.template_act.tags.add(self.tag_foo)
|
||||
self.assertEqual(
|
||||
self.real_act.get_herited('tags').get(),
|
||||
|
|
Loading…
Reference in a new issue