fix admin user persm
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5s

This commit is contained in:
2026-08-03 21:44:55 +05:00
parent 192f987125
commit 9d8b5cd26f
7 changed files with 106 additions and 32 deletions
+9
View File
@@ -15,10 +15,19 @@ def validate_mac_address(value):
return value
def normalize_mac(value):
"""Canonicalize any accepted MAC format to upper-case, dash-separated
form (e.g. "aa:bb:cc:dd:ee:ff" and "aabbccddeeff" -> "AA-BB-CC-DD-EE-FF").
Used so uniqueness is enforced on one canonical representation."""
hex_only = re.sub(r"[^0-9A-Fa-f]", "", value or "").upper()
return "-".join(hex_only[i : i + 2] for i in range(0, len(hex_only), 2))
class Device(models.Model):
name = models.CharField(max_length=255)
mac = models.CharField(
max_length=255,
unique=True,
validators=[
validate_mac_address,
],