models: factorize the WcsInstance notification code in a method
This commit is contained in:
parent
a03acebb69
commit
6d9b70dc84
|
@ -59,9 +59,7 @@ class WcsInstance(models.Model):
|
|||
'site_options_cfg': self.site_options_cfg(),
|
||||
}
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
created = (self.id is None)
|
||||
super(WcsInstance, self).save(*args, **kwargs)
|
||||
def notify(self, created=True):
|
||||
# notify wcsinstd
|
||||
if not settings.WCSINSTD_URL:
|
||||
return
|
||||
|
@ -86,6 +84,11 @@ class WcsInstance(models.Model):
|
|||
out_data = p.read()
|
||||
p.close()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
created = (self.id is None)
|
||||
super(WcsInstance, self).save(*args, **kwargs)
|
||||
self.notify(created)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('wcs instance')
|
||||
verbose_name_plural = _('wcs instances')
|
||||
|
|
Reference in New Issue