blob: 3a7ed5866ce852391c1dd739214d2e4f98a4e1ee [file] [log] [blame]
Matteo Scandoloc48a0fc2018-01-31 11:38:11 -08001from xos.exceptions import XOSValidationError
2
3from models_decl import MCordSubscriberService_decl
4from models_decl import MCordSubscriberInstance_decl
5
6
7
8
9class MCordSubscriberService(MCordSubscriberService_decl):
10 class Meta:
11 proxy = True
12
13
14class MCordSubscriberInstance(MCordSubscriberInstance_decl):
15 class Meta:
16 proxy = True
17
18 def save(self, *args, **kwargs):
19 # NOTE someone is setting owner_id, so just override it for now
20 try:
21 mcord_service = MCordSubscriberService.objects.all()[0]
22 self.owner_id = mcord_service.id
23 except IndexError:
24 raise XOSValidationError("Service MCORD cannot be found, please make sure that the model exists.")
25
26 super(MCordSubscriberInstance, self).save(*args, **kwargs)