fix admin user persm
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5s
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 5s
This commit is contained in:
@@ -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,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user