renamed attribute + PEP

This commit is contained in:
Qwann 2017-07-26 13:15:41 +02:00
parent 4e99a09165
commit f87fe3d5a0
2 changed files with 29 additions and 2 deletions

View file

@ -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'),
),
]

View file

@ -24,7 +24,7 @@ class Event(SubscriptionMixin, models.Model):
related_name="created_events", related_name="created_events",
editable=False, editable=False,
) )
creation_date = models.DateTimeField( created_at = models.DateTimeField(
_('date de création'), _('date de création'),
auto_now_add=True, auto_now_add=True,
) )
@ -179,7 +179,8 @@ class Activity(AbstractActivityTemplate):
end = models.DateTimeField(_("heure de fin")) end = models.DateTimeField(_("heure de fin"))
def get_herited(self, attrname): 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() m2m_fields = [f.name for f in ActivityTemplate._meta.get_fields()
if f.many_to_many] if f.many_to_many]
attr = getattr(self, attrname) attr = getattr(self, attrname)