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

This commit is contained in:
i701 2025-04-25 15:35:57 +05:00
parent 81f907b7bf
commit 20db39ee55
Signed by: i701
GPG Key ID: 54A0DA1E26D8E587

View File

@ -1,12 +1,12 @@
from django.db import models
from django.utils import timezone
from api.models import User
import regex
import re
from django.core.exceptions import ValidationError
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(
"This field accepts a valid MAC address in the format XX-XX-XX-XX-XX-XX using '-' as the separator."
)