Skip to content

Commit

Permalink
fix regex and remove pytz
Browse files Browse the repository at this point in the history
  • Loading branch information
magsyg committed Sep 28, 2023
1 parent 7880f92 commit 317f8ee
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ debugpy = "*"
gunicorn = "*"
django-admin-autocomplete-filter = "*"
django-notifications-hq = "*"
pytz = "*"

[dev-packages]
yapf = "*"
Expand Down
2 changes: 1 addition & 1 deletion backend/samfundet/models/utils/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
kwargs['max_length'] = 15
self.validators = [
RegexValidator(
regex=r'^([\+]?[(]?[0-9]{3}[)]?[-\s\.]?)?[0-9]{3}[-\s\.]?[0-9]{4,6}$',
regex=r'^(\+?\(?\d{3}\)?[-\s\.]?)?\d{3}[-\s\.]?\d{4,6}$',
message='Enter a valid phonenumber',
),
]
Expand Down
2 changes: 1 addition & 1 deletion backend/samfundet/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class RegisterSerializer(serializers.Serializer):
email = serializers.EmailField(label='Email', write_only=True)
phone_number = serializers.RegexField(
label='Phonenumber',
regex=r'^([\+]?[(]?[0-9]{3}[)]?[-\s\.]?)?[0-9]{3}[-\s\.]?[0-9]{4,6}$',
regex=r'^(\+?\(?\d{3}\)?[-\s\.]?)?\d{3}[-\s\.]?\d{4,6}$',
write_only=True,
)
firstname = serializers.CharField(label='First name', write_only=True)
Expand Down

0 comments on commit 317f8ee

Please sign in to comment.