From 1535be350f02b8ec73010e486f4066e97652d246 Mon Sep 17 00:00:00 2001 From: Arne de Laat Date: Mon, 14 Apr 2025 20:07:16 +0200 Subject: [PATCH] Fix hex encoding a byte string Old code lead to: AttributeError: 'bytes' object has no attribute 'encode'. --- publicdb/station_layout/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publicdb/station_layout/models.py b/publicdb/station_layout/models.py index f6562c1d..6afdfdc9 100644 --- a/publicdb/station_layout/models.py +++ b/publicdb/station_layout/models.py @@ -95,8 +95,8 @@ class Meta: verbose_name_plural = 'Station layouts quarantine' def generate_hashes(self): - hash_submit = os.urandom(16).encode('hex') - hash_review = os.urandom(16).encode('hex') + hash_submit = os.urandom(16).hex() + hash_review = os.urandom(16).hex() if StationLayoutQuarantine.objects.filter(hash_submit=hash_submit) or StationLayoutQuarantine.objects.filter( hash_review=hash_review, ):