Skip to content

Commit

Permalink
Order courses for selection in cms CoursePage (#2535)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
annagav and pre-commit-ci[bot] authored Feb 7, 2025
1 parent 85649e3 commit 2e3b11a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions courses/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CourseAdmin(admin.ModelAdmin):

model = Course
search_fields = ["title", "departments__name", "readable_id"]
ordering = ("id",)
list_display = (
"id",
"title",
Expand Down
16 changes: 16 additions & 0 deletions courses/migrations/0058_alter_course_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.18 on 2025-02-06 18:17

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("courses", "0057_alter_program_end_date_alter_program_start_date"),
]

operations = [
migrations.AlterModelOptions(
name="course",
options={"ordering": ["readable_id"]},
),
]
2 changes: 1 addition & 1 deletion courses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ class Course(TimestampedModel, ValidateOnSaveMixin):
"""Model for a course"""

class Meta:
ordering = ["id"]
ordering = ["readable_id"]

objects = CourseQuerySet.as_manager()
title = models.CharField(max_length=255)
Expand Down

0 comments on commit 2e3b11a

Please sign in to comment.