Index the is_stub and is_deleted document boolean fields.

This commit is contained in:
Roberto Rosario
2016-05-09 19:54:32 -04:00
parent 8075bfd0bc
commit 8d549df088
2 changed files with 29 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('documents', '0033_auto_20160325_0052'),
]
operations = [
migrations.AlterField(
model_name='document',
name='in_trash',
field=models.BooleanField(default=False, verbose_name='In trash?', db_index=True, editable=False),
),
migrations.AlterField(
model_name='document',
name='is_stub',
field=models.BooleanField(default=True, editable=False, help_text='A document stub is a document with an entry on the database but no file uploaded. This could be an interrupted upload or a deferred upload via the API.', verbose_name='Is stub?', db_index=True),
),
]

View File

@@ -169,7 +169,8 @@ class Document(models.Model):
verbose_name=_('Language')
)
in_trash = models.BooleanField(
default=False, editable=False, verbose_name=_('In trash?')
db_index=True, default=False, editable=False,
verbose_name=_('In trash?')
)
# TODO: set editable to False
deleted_date_time = models.DateTimeField(
@@ -177,10 +178,11 @@ class Document(models.Model):
verbose_name=_('Date and time trashed')
)
is_stub = models.BooleanField(
default=True, editable=False, help_text=_(
db_index=True, default=True, editable=False, help_text=_(
'A document stub is a document with an entry on the database but '
'no file uploaded. This could be an interrupted upload or a '
'deferred upload via the API.'), verbose_name=_('Is stub?')
'deferred upload via the API.'
), verbose_name=_('Is stub?')
)
objects = DocumentManager()