Reorganize and sort models and managers according to Mayan's best practices.
Signed-off-by: Michael Price <loneviking72@gmail.com>
This commit is contained in:
committed by
Roberto Rosario
parent
a172538dfc
commit
28aa0b913c
@@ -22,15 +22,13 @@ class Lock(models.Model):
|
||||
|
||||
objects = LockManager()
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Lock')
|
||||
verbose_name_plural = _('Locks')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.timeout and not kwargs.get('timeout'):
|
||||
self.timeout = setting_default_lock_timeout.value
|
||||
|
||||
super(Lock, self).save(*args, **kwargs)
|
||||
|
||||
def release(self):
|
||||
try:
|
||||
lock = Lock.objects.get(
|
||||
@@ -42,6 +40,8 @@ class Lock(models.Model):
|
||||
else:
|
||||
lock.delete()
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Lock')
|
||||
verbose_name_plural = _('Locks')
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.timeout and not kwargs.get('timeout'):
|
||||
self.timeout = setting_default_lock_timeout.value
|
||||
|
||||
super(Lock, self).save(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user