Skip to content

Commit

Permalink
[requested-change] Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Jun 16, 2021
1 parent d2a53a9 commit 6014c98
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 0 additions & 12 deletions openwisp_controller/config/base/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,10 @@ def save(self, *args, **kwargs):
self._check_changed_fields()

def _check_changed_fields(self):
# self._load_deferred_fields(fields=['name', 'group_id', 'management_ip'])
self._check_management_ip_changed()
self._check_name_changed()
self._check_group_changed()

def _load_deferred_fields(self, fields=[]):
for field in fields:
try:
getattr(self, f'_initial_{field}')
except AttributeError:
current = []
for field_ in fields:
current.append(getattr(self,))
self.refresh_from_db(fields=set(fields))
break

def _is_field_deferred(self, field_name):
return field_name in self.get_deferred_fields()

Expand Down
1 change: 1 addition & 0 deletions tests/openwisp2/sample_config/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class TestConfigApi(BaseTestConfigApi):


del BaseTestAdmin
del BaseTestDeviceGroupAdmin
del BaseTestConfig
del BaseTestTransactionConfig
del BaseTestController
Expand Down

0 comments on commit 6014c98

Please sign in to comment.