From f87fe3d5a021a0ce471a3eedf404e88841212e3d Mon Sep 17 00:00:00 2001 From: Qwann Date: Wed, 26 Jul 2017 13:15:41 +0200 Subject: [PATCH 1/2] renamed attribute + PEP --- event/migrations/0003_auto_20170726_1116.py | 26 +++++++++++++++++++++ event/models.py | 5 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 event/migrations/0003_auto_20170726_1116.py diff --git a/event/migrations/0003_auto_20170726_1116.py b/event/migrations/0003_auto_20170726_1116.py new file mode 100644 index 0000000..e776702 --- /dev/null +++ b/event/migrations/0003_auto_20170726_1116.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.3 on 2017-07-26 11:16 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('event', '0002_auto_20170723_1419'), + ] + + operations = [ + migrations.RenameField( + model_name='event', + old_name='creation_date', + new_name='created_at', + ), + migrations.AlterField( + model_name='activity', + name='parent', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='event.ActivityTemplate'), + ), + ] diff --git a/event/models.py b/event/models.py index 957e13a..eebe9b3 100644 --- a/event/models.py +++ b/event/models.py @@ -24,7 +24,7 @@ class Event(SubscriptionMixin, models.Model): related_name="created_events", editable=False, ) - creation_date = models.DateTimeField( + created_at = models.DateTimeField( _('date de création'), auto_now_add=True, ) @@ -179,7 +179,8 @@ class Activity(AbstractActivityTemplate): end = models.DateTimeField(_("heure de fin")) def get_herited(self, attrname): - inherited_fields = [f.name for f in ActivityTemplate._meta.get_fields()] + inherited_fields = [f.name for f in + ActivityTemplate._meta.get_fields()] m2m_fields = [f.name for f in ActivityTemplate._meta.get_fields() if f.many_to_many] attr = getattr(self, attrname) From 5e1a0cc0efcfb438739bb9c60972b133f0ccae91 Mon Sep 17 00:00:00 2001 From: Qwann Date: Wed, 26 Jul 2017 13:48:12 +0200 Subject: [PATCH 2/2] fixe tests --- communication/tests.py | 2 +- event/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/communication/tests.py b/communication/tests.py index e9a1061..800eac6 100644 --- a/communication/tests.py +++ b/communication/tests.py @@ -26,7 +26,7 @@ class SubscriptionTest(TestCase): title='TestEvent', slug='test', created_by=cls.root, - creation_date=timezone.now(), + created_at=timezone.now(), description="Ceci est un test", beginning_date=timezone.now() + timedelta(days=30), diff --git a/event/tests.py b/event/tests.py index f94b5ab..36dee90 100644 --- a/event/tests.py +++ b/event/tests.py @@ -22,7 +22,7 @@ class ActivityInheritanceTest(TestCase): title='La Nuit 2042', slug='nuit42', created_by=cls.erkan, - creation_date=timezone.now(), + created_at=timezone.now(), description="La nuit c'est lol", beginning_date=timezone.now() + timedelta(days=30),