Use proper SQL concatenation

This commit is contained in:
2026-01-23 19:41:37 +01:00
parent f0b924ea56
commit feb4a67291

View File

@@ -9,6 +9,7 @@ from peewee import (
CharField, CharField,
DateTimeField, DateTimeField,
DoesNotExist, DoesNotExist,
fn,
ForeignKeyField, ForeignKeyField,
IntegerField, IntegerField,
Model, Model,
@@ -297,7 +298,7 @@ def get_hostname_for_user(hostname: str, user: User):
Raises: Raises:
DoesNotExist: If hostname not found or not owned by user. DoesNotExist: If hostname not found or not owned by user.
""" """
fqdn = Hostname.hostname + '.' + Hostname.zone fqdn = fn.Concat(Hostname.hostname, '.', Hostname.zone)
return Hostname.get((fqdn == hostname) & (Hostname.user == user)) return Hostname.get((fqdn == hostname) & (Hostname.user == user))