Update coupon ordering

This commit is contained in:
Nathan Chapman 2022-11-01 18:33:35 -06:00
parent d0621b2d47
commit 4955bf8dd9
3 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 4.0.2 on 2022-11-02 00:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_shippingrate_is_selectable_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='coupon',
options={'ordering': ['valid_from', 'valid_to', 'code']},
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 4.0.2 on 2022-11-02 00:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0003_alter_coupon_options'),
]
operations = [
migrations.AlterModelOptions(
name='coupon',
options={'ordering': ['-valid_from', '-valid_to', 'code']},
),
]

View File

@ -226,7 +226,7 @@ class Coupon(models.Model):
users = models.ManyToManyField(User, blank=True)
class Meta:
ordering = ("code",)
ordering = ['-valid_from', '-valid_to', 'code']
def __str__(self):
return self.name