Skip to content

Commit

Permalink
[fix] Fixed DeviceResource and GeoDeviceResource
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Sep 4, 2024
1 parent 4a9a446 commit c95e91f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions openwisp_controller/config/exportable.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def validate_instance(
if config.device_id != instance.id:
config.device_id = instance.id

def after_save_instance(self, instance, using_transactions, dry_run):
super().after_save_instance(instance, using_transactions, dry_run)
if not dry_run:
# save config afte device has been imported
def after_save_instance(self, instance, row, **kwargs):
super().after_save_instance(instance, row, **kwargs)
if not self._is_dry_run(kwargs):
# save config after device has been imported
if instance._has_config():
instance.config.save()

Expand Down
10 changes: 5 additions & 5 deletions openwisp_controller/geo/exportable.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def dehydrate_coords(self, device):
except (ObjectDoesNotExist, AttributeError):
pass

def after_import_instance(self, instance, new, row_number=None, **kwargs):
super().after_import_instance(instance, new, row_number, **kwargs)
def after_init_instance(self, instance, new, row, **kwargs):
super().after_init_instance(instance, new, row, **kwargs)
if not hasattr(instance, 'devicelocation'):
instance.devicelocation = DeviceLocation()

Expand All @@ -68,9 +68,9 @@ def validate_instance(
if device_location.location_id or device_location.floorplan_id:
device_location.content_object_id = instance.id

def after_save_instance(self, instance, using_transactions, dry_run):
super().after_save_instance(instance, using_transactions, dry_run)
if not dry_run:
def after_save_instance(self, instance, row, **kwargs):
super().after_save_instance(instance, row, **kwargs)
if not self._is_dry_run(kwargs):
device_location = instance.devicelocation
if device_location.location_id or device_location.floorplan_id:
device_location.save()
Expand Down

0 comments on commit c95e91f

Please sign in to comment.