Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ordering for DifficultyTag and DiffultyTagLocalization #438

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions oioioi/problems/migrations/0032_alter_difficultytag_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.17 on 2024-12-15 12:52

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('problems', '0031_auto_20220328_1124'),
]

operations = [
migrations.AlterModelOptions(
name='difficultytag',
options={'ordering': ['pk'], 'verbose_name': 'difficulty tag', 'verbose_name_plural': 'difficulty tags'},
),
]
1 change: 1 addition & 0 deletions oioioi/problems/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ class DifficultyTag(models.Model):
class Meta(object):
verbose_name = _("difficulty tag")
verbose_name_plural = _("difficulty tags")
ordering = ["pk"]

def __str__(self):
return str(self.name)
Expand Down
4 changes: 2 additions & 2 deletions oioioi/problems/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def problemset_generate_view(request, page_title, problems, view_type):

difficulty_tags = DifficultyTag.objects.filter(
name__in=request.GET.getlist('difficulty')
)
).order_by("name")

return TemplateResponse(
request,
Expand Down Expand Up @@ -553,7 +553,7 @@ def problem_site_view(request, site_key):
)
difficulty_options = (
tag.full_name
for tag in DifficultyTagLocalization.objects.filter(language=get_language())
for tag in DifficultyTagLocalization.objects.filter(language=get_language()).order_by("full_name")
)
context = {
'problem': problem,
Expand Down
Loading