blob: a294f2d2f77cd8ce646a2c19f470fd492c6e505b [file] [log] [blame]
Sapan Bhatiaa46cc4d2017-04-21 14:57:54 +02001def __init__(self, *args, **kwargs):
Scott Baker2d200572017-05-25 10:52:00 -07002 onos_services = ONOSService.objects.all()
Sapan Bhatiaa46cc4d2017-04-21 14:57:54 +02003 if onos_services:
4 self._meta.get_field("provider_service").default = onos_services[0].id
5 super(ONOSApp, self).__init__(*args, **kwargs)
6
7def save(self, *args, **kwargs):
8 if not self.creator:
9 if not getattr(self, "caller", None):
10 # caller must be set when creating a vCPE since it creates a slice
11 raise XOSProgrammingError("ONOSApp's self.caller was not set")
12 self.creator = self.caller
13 if not self.creator:
14 raise XOSProgrammingError("ONOSApp's self.creator was not set")
15
16 super(ONOSApp, self).save(*args, **kwargs)
17