kopia lustrzana https://github.com/wagtail/wagtail
Added index on AbstractImage.created_at
Fixes #1598 Speeds up image index/chooser when many images exist in the sitepull/1623/head
rodzic
a8a7344927
commit
9bd04efd05
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('tests', '0006_image_file_size'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customimagewithadminformfields',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(db_index=True, verbose_name='Created at', auto_now_add=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='customimagewithoutadminformfields',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(db_index=True, verbose_name='Created at', auto_now_add=True),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wagtailimages', '0007_image_file_size'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='image',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(db_index=True, verbose_name='Created at', auto_now_add=True),
|
||||
),
|
||||
]
|
|
@ -63,7 +63,7 @@ class AbstractImage(models.Model, TagSearchable):
|
|||
file = models.ImageField(verbose_name=_('File'), upload_to=get_upload_to, width_field='width', height_field='height')
|
||||
width = models.IntegerField(verbose_name=_('Width'), editable=False)
|
||||
height = models.IntegerField(verbose_name=_('Height'), editable=False)
|
||||
created_at = models.DateTimeField(verbose_name=_('Created at'), auto_now_add=True)
|
||||
created_at = models.DateTimeField(verbose_name=_('Created at'), auto_now_add=True, db_index=True)
|
||||
uploaded_by_user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('Uploaded by user'), null=True, blank=True, editable=False)
|
||||
|
||||
tags = TaggableManager(help_text=None, blank=True, verbose_name=_('Tags'))
|
||||
|
|
Ładowanie…
Reference in New Issue