Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/core/admin.py b/xos/core/admin.py
index bc083c4..993a6f8 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -789,14 +789,34 @@
 
         return AdminFormMetaClass
 
+class ControllerAdminForm(forms.ModelForm):
+    backend_disabled = forms.BooleanField(required=False)
+    class Meta:
+        model = Controller
+
+    def __init__(self, *args, **kwargs):
+      request = kwargs.pop('request', None)
+      super(ControllerAdminForm, self).__init__(*args, **kwargs)
+
+      if self.instance and self.instance.pk:
+        self.fields['backend_disabled'].initial = self.instance.get_backend_register('disabled', False)
+      else:
+        # defaults when adding new controller
+        self.fields['backend_disabled'].initial = False
+
+    def save(self, commit=True):
+      self.instance.set_backend_register("disabled", self.cleaned_data["backend_disabled"])
+      return super(ControllerAdminForm, self).save(commit=commit)
+
 class ControllerAdmin(XOSBaseAdmin):
     model = Controller
-    fieldList = ['deployment', 'name', 'backend_type', 'version', 'auth_url', 'admin_user', 'admin_tenant','admin_password', 'domain', 'rabbit_host', 'rabbit_user', 'rabbit_password']
+    fieldList = ['deployment', 'name', 'backend_type', 'backend_disabled', 'version', 'auth_url', 'admin_user', 'admin_tenant','admin_password', 'domain', 'rabbit_host', 'rabbit_user', 'rabbit_password']
     fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-general']})]
     inlines = [ControllerSiteInline] # ,ControllerImagesInline]
     list_display = ['backend_status_icon', 'name', 'version', 'backend_type']
     list_display_links = ('backend_status_icon', 'name', )
     readonly_fields = ('backend_status_text',)
+    form = ControllerAdminForm
 
     user_readonly_fields = []
 
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 5c0d7ab..0822bf5 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -119,6 +119,22 @@
             validators[field.name] = l
         return validators
 
+    def get_backend_register(self, k, default=None):
+        try:
+            return json.loads(self.backend_register).get(k, default)
+        except AttributeError:
+            return default
+
+    def set_backend_register(self, k, v):
+        br = {}
+        try:
+            br=json.loads(self.backend_register)
+        except AttributeError:
+            br={}
+
+        br[k] = v
+        self.backend_register = json.dumps(br)
+
     def get_backend_details(self):
         try:
             scratchpad = json.loads(self.backend_register)