Commit 0beed7a0 authored by Jamesie Pic's avatar Jamesie Pic

Index Proposal.datetime

It's used to sort Votes, takes votes list of 10 items in the API from 5s
to 300ms.
parent 87c60f6d
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('representatives_votes', '0009_dossier_ext_link'),
]
operations = [
migrations.AlterField(
model_name='proposal',
name='datetime',
field=models.DateTimeField(db_index=True),
),
]
......@@ -27,7 +27,7 @@ class Proposal(HashableModel, TimeStampedModel):
title = models.CharField(max_length=1000, unique=True)
description = models.TextField(blank=True, default='')
reference = models.CharField(max_length=200, blank=True, null=True)
datetime = models.DateTimeField()
datetime = models.DateTimeField(db_index=True)
kind = models.CharField(max_length=200, blank=True, default='')
total_abstain = models.IntegerField()
total_against = models.IntegerField()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment