mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-05-01 08:25:41 +00:00
Fix import statement for regex module in MAC address validation
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 2m14s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 2m14s
This commit is contained in:
parent
81f907b7bf
commit
20db39ee55
@ -1,12 +1,12 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from api.models import User
|
from api.models import User
|
||||||
import regex
|
import re
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
def validate_mac_address(value):
|
def validate_mac_address(value):
|
||||||
if not regex.match(r"^([0-9A-Fa-f]{2}-){5}[0-9A-Fa-f]{2}$", value):
|
if not re.match(r"^([0-9A-Fa-f]{2}-){5}[0-9A-Fa-f]{2}$", value):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"This field accepts a valid MAC address in the format XX-XX-XX-XX-XX-XX using '-' as the separator."
|
"This field accepts a valid MAC address in the format XX-XX-XX-XX-XX-XX using '-' as the separator."
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user