Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] MAC address set to uppercase when creating a registering a new #937

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openwisp_controller/config/base/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def _validate_unique_name(self):
)

def clean(self, *args, **kwargs):
self.mac_address = self.mac_address.upper()
super().clean(*args, **kwargs)
self._validate_unique_name()
self._validate_org_relation('group', field_error='group')
Expand Down
5 changes: 4 additions & 1 deletion openwisp_controller/config/controller/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ def init_object(self, **kwargs):
device_model._meta.get_field(attr)
except FieldDoesNotExist:
continue
options[attr] = kwargs.get(attr)
if attr == 'mac_address':
options[attr] = kwargs.get(attr).upper()
else:
options[attr] = kwargs.get(attr)
chahatsagarmain marked this conversation as resolved.
Show resolved Hide resolved
# do not specify key if:
# app_settings.CONSISTENT_REGISTRATION is False
# if key is ``None`` (it would cause exception)
Expand Down