app: Fix build issue with Django 5.x

Closes: #1131272 (Debian)

Tests:

- With Django 4.2 (stable container), syncthing app installs properly and home
page shows the tags properly.

- With Django 6.0 (unstable+experimental container), syncthing app installs
properly and home page shows the tags properly.

- With a cowbuilder base image of Ubuntu resolute distribution, freedombox
package builds successfully with gbp.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Sunil Mohan Adapa 2026-03-19 11:52:36 -07:00 committed by Joseph Nuthalapati
parent 7d3c4812e9
commit c66e78c203
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35

View File

@ -574,10 +574,19 @@ class Info(FollowerComponent):
except ImproperlyConfigured:
# Hack to allow apps to be instantiated without Django
# initialization as required by privileged process.
return [
tag._proxy____args[0] if isinstance(tag, Promise) else tag
for tag in self._tags
]
def _make_str(tag):
"""Return the string without casting."""
if not isinstance(tag, Promise):
return tag
# Django 4.2
if hasattr(tag, '_proxy____args'):
return tag._proxy____args[0]
# Django 5.x
return tag._args[0]
return [_make_str(tag) for tag in self._tags]
class EnableState(LeaderComponent):