Instantiate dynamic model from instance
This commit is contained in:
parent
ba30fb0402
commit
fd3cb6a1d4
1 changed files with 14 additions and 0 deletions
|
@ -651,6 +651,20 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
|||
spec.pop("writeConnectionSecretToRef", None)
|
||||
return spec
|
||||
|
||||
@cached_property
|
||||
def spec_object(self):
|
||||
"""Dynamically generated CRD object."""
|
||||
return self.context.django_model(
|
||||
name=self.name,
|
||||
organization=self.organization,
|
||||
context=self.context,
|
||||
spec=self.spec,
|
||||
# We pass -1 as ID in order to make it clear that a) this object exists (remotely),
|
||||
# and b) it’s not a normal database object. This allows us to treat e.g. update
|
||||
# forms differently from create forms.
|
||||
pk=-1,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def status_conditions(self):
|
||||
if not self.kubernetes_object:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue