From ec307cd5df3d461933134590ef7cb843ebd35305 Mon Sep 17 00:00:00 2001 From: Skia Date: Sat, 20 May 2017 12:37:51 +0200 Subject: [PATCH] Add db index in counter --- counter/migrations/0012_auto_20170515_2202.py | 19 +++++++++++++++++++ counter/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 counter/migrations/0012_auto_20170515_2202.py diff --git a/counter/migrations/0012_auto_20170515_2202.py b/counter/migrations/0012_auto_20170515_2202.py new file mode 100644 index 00000000..8c2ead76 --- /dev/null +++ b/counter/migrations/0012_auto_20170515_2202.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('counter', '0011_auto_20161004_2039'), + ] + + operations = [ + migrations.AlterField( + model_name='permanency', + name='end', + field=models.DateTimeField(db_index=True, verbose_name='end date', null=True), + ), + ] diff --git a/counter/models.py b/counter/models.py index f45debd6..73582464 100644 --- a/counter/models.py +++ b/counter/models.py @@ -431,7 +431,7 @@ class Permanency(models.Model): user = models.ForeignKey(User, related_name="permanencies", verbose_name=_("user")) counter = models.ForeignKey(Counter, related_name="permanencies", verbose_name=_("counter")) start = models.DateTimeField(_('start date')) - end = models.DateTimeField(_('end date'), null=True) + end = models.DateTimeField(_('end date'), null=True, db_index=True) activity = models.DateTimeField(_('last activity date'), auto_now=True) class Meta: