CORD-1092: Example service ported over to xproto
Change-Id: I3edd49d1c1e87c800b5bc8cb2316cb8bc19f4bc2
diff --git a/xos/attic/exampletenant_bottom.py b/xos/attic/exampletenant_bottom.py
new file mode 100644
index 0000000..7ac737e
--- /dev/null
+++ b/xos/attic/exampletenant_bottom.py
@@ -0,0 +1,8 @@
+def model_policy_exampletenant(pk):
+ with transaction.atomic():
+ tenant = ExampleTenant.objects.select_for_update().filter(pk=pk)
+ if not tenant:
+ return
+ tenant = tenant[0]
+ tenant.manage_container()
+
diff --git a/xos/attic/exampletenant_model.py b/xos/attic/exampletenant_model.py
new file mode 100644
index 0000000..ad69d03
--- /dev/null
+++ b/xos/attic/exampletenant_model.py
@@ -0,0 +1,14 @@
+def __init__(self, *args, **kwargs):
+ exampleservice = ExampleService.get_service_objects().all()
+ if exampleservice:
+ self._meta.get_field('provider_service').default = exampleservice[0].id
+ super(ExampleTenant, self).__init__(*args, **kwargs)
+
+def save(self, *args, **kwargs):
+ super(ExampleTenant, self).save(*args, **kwargs)
+ model_policy_exampletenant(self.pk)
+
+def delete(self, *args, **kwargs):
+ self.cleanup_container()
+ super(ExampleTenant, self).delete(*args, **kwargs)
+
diff --git a/xos/attic/header.py b/xos/attic/header.py
new file mode 100644
index 0000000..d7fcd1e
--- /dev/null
+++ b/xos/attic/header.py
@@ -0,0 +1,11 @@
+# models.py - ExampleService Models
+
+from core.models import Service, TenantWithContainer
+from django.db import transaction
+from django.db.models import *
+
+SERVICE_NAME = 'exampleservice'
+SERVICE_NAME_VERBOSE = 'Example Service'
+SERVICE_NAME_VERBOSE_PLURAL = 'Example Services'
+TENANT_NAME_VERBOSE = 'Example Tenant'
+TENANT_NAME_VERBOSE_PLURAL = 'Example Tenants'