Extensions list: sort_by parameter #159
@ -0,0 +1,29 @@
|
|||||||
|
# Generated by Django 4.2.11 on 2024-05-31 10:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('extensions', '0031_extension_latest_version'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='extension',
|
||||||
|
index=models.Index(fields=['is_listed', 'type', 'average_score'], name='extensions__is_list_765936_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='extension',
|
||||||
|
index=models.Index(fields=['is_listed', 'type', 'date_approved'], name='extensions__is_list_63d6cb_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='extension',
|
||||||
|
index=models.Index(fields=['is_listed', 'type', 'download_count'], name='extensions__is_list_46cfa1_idx'),
|
||||||
|
),
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name='extension',
|
||||||
|
index=models.Index(fields=['is_listed', 'type', 'name'], name='extensions__is_list_7571c8_idx'),
|
||||||
|
),
|
||||||
|
]
|
@ -220,6 +220,12 @@ class Extension(CreatedModifiedMixin, RatingMixin, TrackChangesMixin, models.Mod
|
|||||||
objects = ExtensionManager()
|
objects = ExtensionManager()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=['is_listed', 'type', 'average_score']),
|
||||||
|
models.Index(fields=['is_listed', 'type', 'date_approved']),
|
||||||
|
models.Index(fields=['is_listed', 'type', 'download_count']),
|
||||||
|
models.Index(fields=['is_listed', 'type', 'name']),
|
||||||
|
]
|
||||||
ordering = ['-average_score', '-date_created', 'name']
|
ordering = ['-average_score', '-date_created', 'name']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user