feat(admin): enhance AdminTopupCreateView to support custom top-up descriptions
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m25s

This commit is contained in:
2025-07-27 19:55:22 +05:00
parent e3c2d4450f
commit 19321da0be
2 changed files with 10 additions and 3 deletions

View File

@@ -76,7 +76,8 @@ class DeviceListCreateAPIView(
{"message": "Device name is too long."},
status=400,
)
mac = request.data.get("mac", None)
raw_mac = request.data.get("mac", None)
mac = raw_mac.strip() if raw_mac else None
MAC_REGEX = re.compile(r"^([0-9A-Fa-f]{2}([.:-]?)){5}[0-9A-Fa-f]{2}$")
NORMALIZE_MAC_REGEX = re.compile(r"[^0-9A-Fa-f]")
if not isinstance(mac, str) or not MAC_REGEX.match(mac):