# how to tell admin.display decorator to order the results by two columns

**URL:** <https://forum.djangoproject.com/t/how-to-tell-admin-display-decorator-to-order-the-results-by-two-columns/21418>\
**Category:** The Admin\
**Created:** [June 7, 2023, 5:30pm UTC](https://forum.djangoproject.com/t/how-to-tell-admin-display-decorator-to-order-the-results-by-two-columns/21418 "2023-06-07T17:30:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeaDSouL](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/deadsoul/32/14023_2.png) [@DeaDSouL](https://forum.djangoproject.com/u/DeaDSouL)\
**Post date:** [June 7, 2023, 5:30pm UTC](https://forum.djangoproject.com/t/how-to-tell-admin-display-decorator-to-order-the-results-by-two-columns/21418/1 "2023-06-07T17:30:10Z")

</div>

Hello,

Please consider the following example:

```auto
# models.py

class Case(models.Model):
    number = models.SmallIntegerField(null=False, blank=False)
    year = models.SmallIntegerField(null=False, blank=False)
    ...

```

```auto
#admin.py

@admin.register(Case)
class CaseAdmin(admin.ModelAdmin):
    list_display = ['case_number', ...]
    ordering = ['-year', '-number']

    @admin.display(ordering=['-year', '-number'])
    def case_number(self, case):
        return f'{case.number} / {case.year}'

```

Now how can I specify the order to be by `'-year'` and `'-number'` using the `admin.display()` decorator?

If it can not be done with the `admin.display()` decorator, is there another way to achieve that?

Thanks
