Skip to content

Commit 752c07c

Browse files
committed
django 5.2 compatibility updates
- replace unique_together with UniqueConstraint across all models - remove deprecated USE_L10N setting (default since django 4.0) - import include from django.urls instead of django.conf.urls - use request.headers instead of request.META for http headers - use @admin.register decorator style - update INSTALL.md for ubuntu 26.04 (resolute)
1 parent bb53742 commit 752c07c

21 files changed

+180
-29
lines changed

INSTALL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ mysql or postgresql instead, see the database configuration section.
55

66

77
## Supported Server Installation Options
8-
- [Ubuntu 24.04](#ubuntu-2404-noble)
8+
- [Ubuntu 26.04](#ubuntu-2604-noble)
99
- [Debian 13](#debian-13-trixie)
1010
- [Rocky 10](#rocky-10)
1111
- [virtualenv + pip](#virtualenv--pip)
1212
- [Source](#source)
1313

1414

15-
### Ubuntu 24.04 (noble)
15+
### Ubuntu 26.04 (resolute)
1616

1717
```shell
1818
curl -sS https://repo.openbytes.ie/openbytes.gpg > /usr/share/keyrings/openbytes.gpg
19-
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu noble-backports main" > /etc/apt/sources.list.d/patchman.list
19+
echo "deb [signed-by=/usr/share/keyrings/openbytes.gpg] https://repo.openbytes.ie/patchman/ubuntu resolute main" > /etc/apt/sources.list.d/patchman.list
2020
apt update
2121
apt -y install python3-patchman patchman-client
2222
patchman-manage createsuperuser
@@ -74,7 +74,7 @@ gunicorn patchman.wsgi -b 0.0.0.0:80
7474

7575
### Source
7676

77-
#### Ubuntu 24.04 (noble)
77+
#### Ubuntu 26.04 (resolute)
7878

7979
1. Install dependencies
8080

errata/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
from errata.models import Erratum
2020

2121

22+
@admin.register(Erratum)
2223
class ErratumAdmin(admin.ModelAdmin):
2324
readonly_fields = ('affected_packages', 'fixed_packages', 'references')
24-
25-
26-
admin.site.register(Erratum, ErratumAdmin)

hosts/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from hosts.models import Host, HostRepo
2121

2222

23+
@admin.register(Host)
2324
class HostAdmin(admin.ModelAdmin):
2425
readonly_fields = ('packages', 'updates')
2526

2627

27-
admin.site.register(Host, HostAdmin)
2828
admin.site.register(HostRepo)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 4.2.28 on 2026-04-01 03:15
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('hosts', '0012_backfill_cached_counts'),
10+
]
11+
12+
operations = [
13+
migrations.AlterUniqueTogether(
14+
name='hostrepo',
15+
unique_together=set(),
16+
),
17+
migrations.AddConstraint(
18+
model_name='hostrepo',
19+
constraint=models.UniqueConstraint(fields=('host', 'repo'), name='unique_hostrepo'),
20+
),
21+
]

hosts/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,12 @@ class HostRepo(models.Model):
646646
priority = models.IntegerField(default=0)
647647

648648
class Meta:
649-
unique_together = ['host', 'repo']
649+
constraints = [
650+
models.UniqueConstraint(
651+
fields=['host', 'repo'],
652+
name='unique_hostrepo',
653+
),
654+
]
650655
ordering = ['host', 'repo']
651656

652657
def __str__(self):
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 4.2.28 on 2026-04-01 03:15
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('modules', '0006_alter_module_context_alter_module_name_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterUniqueTogether(
14+
name='module',
15+
unique_together=set(),
16+
),
17+
migrations.AddConstraint(
18+
model_name='module',
19+
constraint=models.UniqueConstraint(fields=('name', 'stream', 'version', 'context', 'arch', 'repo'), name='unique_module'),
20+
),
21+
]

modules/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class Module(models.Model):
3535
class Meta:
3636
verbose_name = 'Module'
3737
verbose_name_plural = 'Modules'
38-
unique_together = ['name', 'stream', 'version', 'context', 'arch', 'repo']
38+
constraints = [
39+
models.UniqueConstraint(
40+
fields=['name', 'stream', 'version', 'context', 'arch', 'repo'],
41+
name='unique_module',
42+
),
43+
]
3944
ordering = ['name', 'stream']
4045

4146
def __str__(self):

operatingsystems/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from operatingsystems.models import OSRelease, OSVariant
2121

2222

23+
@admin.register(OSRelease)
2324
class OSReleaseAdmin(admin.ModelAdmin):
2425
filter_horizontal = ('repos',)
2526

2627

2728
admin.site.register(OSVariant)
28-
admin.site.register(OSRelease, OSReleaseAdmin)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 4.2.28 on 2026-04-01 03:15
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('operatingsystems', '0011_alter_osrelease_codename_alter_osrelease_cpe_name_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterUniqueTogether(
14+
name='osrelease',
15+
unique_together=set(),
16+
),
17+
migrations.AddConstraint(
18+
model_name='osrelease',
19+
constraint=models.UniqueConstraint(fields=('name', 'codename', 'cpe_name'), name='unique_osrelease'),
20+
),
21+
]

operatingsystems/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class OSRelease(models.Model):
3535
class Meta:
3636
verbose_name = 'Operating System Release'
3737
verbose_name_plural = 'Operating System Releases'
38-
unique_together = ['name', 'codename', 'cpe_name']
38+
constraints = [
39+
models.UniqueConstraint(
40+
fields=['name', 'codename', 'cpe_name'],
41+
name='unique_osrelease',
42+
),
43+
]
3944
ordering = ['name']
4045

4146
def __str__(self):

0 commit comments

Comments
 (0)