1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00
This commit is contained in:
Adolfo Gómez García 2019-02-24 11:30:44 +01:00
parent cd7beac87e
commit 2b653b8b05
2 changed files with 7 additions and 4 deletions

View File

@ -40,7 +40,7 @@ from uds.models import UserService
import logging
__updated__ = '2019-02-22'
__updated__ = '2019-02-24'
logger = logging.getLogger(__name__)
@ -63,9 +63,9 @@ class StateUpdater(object):
def save(self, newState=None):
if newState is not None:
self.userService.setState(newState)
self.userService.updateData(self.userServiceInstance)
self.userService.save(update_fields=['data', 'state', 'state_date'])
self.userService.setState(newState) # This saves state & state_date
self.userService.updateData(self.userServiceInstance) # This saves data
# self.userService.save(update_fields=['data', 'state', 'state_date'])
def checkLater(self):
UserServiceOpChecker.checkLater(self.userService, self.userServiceInstance)

View File

@ -188,6 +188,7 @@ class UserService(UUIDModel):
:note: This method do not saves the updated record, just updates the field
'''
self.data = us.serialize()
self.save(update_fields=['data'])
def getName(self):
'''
@ -320,6 +321,8 @@ class UserService(UUIDModel):
self.state_date = getSqlDatetime()
self.state = state
self.save(update_fields=['state', 'state_date'])
def setOsState(self, state):
'''
Updates the os state (state of the os) of this object and, optionally, saves it