Skip to content

Commit a165e4c

Browse files
committed
Addons: default to semver for sorting versions
1 parent 2ed3727 commit a165e4c

File tree

2 files changed

+91
-3
lines changed

2 files changed

+91
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Generated by Django 4.2.16 on 2024-10-15 16:07
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("projects", "0126_alter_remote_repository_description"),
9+
]
10+
11+
operations = [
12+
migrations.AlterField(
13+
model_name="addonsconfig",
14+
name="flyout_sorting",
15+
field=models.CharField(
16+
choices=[
17+
("alphabetically", "Alphabetically"),
18+
("semver-readthedocs-compatible", "SemVer (Read the Docs)"),
19+
("python-packaging", "Python Packaging (PEP 440 and PEP 425)"),
20+
("calver", "CalVer (YYYY.0M.0M)"),
21+
("custom-pattern", "Define your own pattern"),
22+
],
23+
default="semver-readthedocs-compatible",
24+
max_length=64,
25+
verbose_name="Sorting of versions",
26+
),
27+
),
28+
migrations.AlterField(
29+
model_name="addonsconfig",
30+
name="flyout_sorting_custom_pattern",
31+
field=models.CharField(
32+
blank=True,
33+
default=None,
34+
help_text='Sorting pattern supported by BumpVer (<a href="https://github.com/mbarkhau/bumpver#pattern-examples">See examples</a>)',
35+
max_length=32,
36+
null=True,
37+
verbose_name="Custom version sorting pattern",
38+
),
39+
),
40+
migrations.AlterField(
41+
model_name="addonsconfig",
42+
name="flyout_sorting_latest_stable_at_beginning",
43+
field=models.BooleanField(
44+
default=True,
45+
verbose_name="Show <code>latest</code> and <code>stable</code> at the beginning",
46+
),
47+
),
48+
migrations.AlterField(
49+
model_name="historicaladdonsconfig",
50+
name="flyout_sorting",
51+
field=models.CharField(
52+
choices=[
53+
("alphabetically", "Alphabetically"),
54+
("semver-readthedocs-compatible", "SemVer (Read the Docs)"),
55+
("python-packaging", "Python Packaging (PEP 440 and PEP 425)"),
56+
("calver", "CalVer (YYYY.0M.0M)"),
57+
("custom-pattern", "Define your own pattern"),
58+
],
59+
default="semver-readthedocs-compatible",
60+
max_length=64,
61+
verbose_name="Sorting of versions",
62+
),
63+
),
64+
migrations.AlterField(
65+
model_name="historicaladdonsconfig",
66+
name="flyout_sorting_custom_pattern",
67+
field=models.CharField(
68+
blank=True,
69+
default=None,
70+
help_text='Sorting pattern supported by BumpVer (<a href="https://github.com/mbarkhau/bumpver#pattern-examples">See examples</a>)',
71+
max_length=32,
72+
null=True,
73+
verbose_name="Custom version sorting pattern",
74+
),
75+
),
76+
migrations.AlterField(
77+
model_name="historicaladdonsconfig",
78+
name="flyout_sorting_latest_stable_at_beginning",
79+
field=models.BooleanField(
80+
default=True,
81+
verbose_name="Show <code>latest</code> and <code>stable</code> at the beginning",
82+
),
83+
),
84+
]

readthedocs/projects/models.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
from readthedocs.vcs_support.backends import backend_cls
6363

6464
from .constants import (
65-
ADDONS_FLYOUT_SORTING_ALPHABETICALLY,
6665
ADDONS_FLYOUT_SORTING_CHOICES,
66+
ADDONS_FLYOUT_SORTING_SEMVER_READTHEDOCS_COMPATIBLE,
6767
DOWNLOADABLE_MEDIA_TYPES,
6868
MEDIA_TYPES,
6969
MULTIPLE_VERSIONS_WITH_TRANSLATIONS,
@@ -187,21 +187,25 @@ class AddonsConfig(TimeStampedModel):
187187
# Flyout
188188
flyout_enabled = models.BooleanField(default=True)
189189
flyout_sorting = models.CharField(
190+
verbose_name=_("Sorting of versions"),
190191
choices=ADDONS_FLYOUT_SORTING_CHOICES,
191-
default=ADDONS_FLYOUT_SORTING_ALPHABETICALLY,
192+
default=ADDONS_FLYOUT_SORTING_SEMVER_READTHEDOCS_COMPATIBLE,
192193
max_length=64,
193194
)
194195
flyout_sorting_custom_pattern = models.CharField(
195196
max_length=32,
196197
default=None,
197198
null=True,
198199
blank=True,
200+
verbose_name=_("Custom version sorting pattern"),
199201
help_text="Sorting pattern supported by BumpVer "
200202
'(<a href="https://github.com/mbarkhau/bumpver#pattern-examples">See examples</a>)',
201203
)
202204
flyout_sorting_latest_stable_at_beginning = models.BooleanField(
205+
verbose_name=_(
206+
"Show <code>latest</code> and <code>stable</code> at the beginning"
207+
),
203208
default=True,
204-
help_text="Show <code>latest</code> and <code>stable</code> at the beginning",
205209
)
206210

207211
# Hotkeys

0 commit comments

Comments
 (0)