diff --git a/explorer/app_settings.py b/explorer/app_settings.py
index 8bf69b63..ff89299a 100644
--- a/explorer/app_settings.py
+++ b/explorer/app_settings.py
@@ -170,6 +170,8 @@
# 500mb default max
EXPLORER_MAX_UPLOAD_SIZE = getattr(settings, "EXPLORER_MAX_UPLOAD_SIZE", 500 * 1024 * 1024)
+EXPLORER_HOSTED = getattr(settings, "EXPLORER_HOSTED", True)
+
def has_assistant():
return EXPLORER_AI_API_KEY is not None
diff --git a/explorer/ee/db_connections/models.py b/explorer/ee/db_connections/models.py
index 140543ac..49d853a1 100644
--- a/explorer/ee/db_connections/models.py
+++ b/explorer/ee/db_connections/models.py
@@ -151,7 +151,6 @@ def save(self, *args, **kwargs):
DatabaseConnection.objects.filter(default=True).update(default=False)
else:
# If there is no default set yet, make this newly created one the default.
- # Effectively this is for first-time installations.
has_default = DatabaseConnection.objects.filter(default=True).exists()
if not has_default:
self.default = True
diff --git a/explorer/forms.py b/explorer/forms.py
index e025b558..a28b1db0 100644
--- a/explorer/forms.py
+++ b/explorer/forms.py
@@ -41,7 +41,8 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["database_connection"].widget.choices = self.connections
if not self.instance.database_connection:
- self.initial["database_connection"] = default_db_connection().alias
+ default_db = default_db_connection()
+ self.initial["database_connection"] = default_db_connection().alias if default_db else None
self.fields["database_connection"].widget.attrs["class"] = "form-select"
def clean(self):
@@ -66,6 +67,10 @@ def created_at_time(self):
@property
def connections(self):
+ default_db = default_db_connection()
+ if default_db is None:
+ return []
+
# Ensure the default connection appears first in the dropdown in the form
result = DatabaseConnection.objects.annotate(
custom_order=Case(
diff --git a/explorer/templates/explorer/base.html b/explorer/templates/explorer/base.html
index 32bac5ba..1b4023c4 100644
--- a/explorer/templates/explorer/base.html
+++ b/explorer/templates/explorer/base.html
@@ -80,6 +80,12 @@
This is easy to fix, I promise!
{% translate "Favorites" %}
+ {% if hosted %}
+
+ Manage
+
+ {% endif %}
diff --git a/explorer/templates/explorer/play.html b/explorer/templates/explorer/play.html
index eb3935c0..ded60a33 100644
--- a/explorer/templates/explorer/play.html
+++ b/explorer/templates/explorer/play.html
@@ -16,7 +16,7 @@ {% translate "Playground" %}
{{ error|escape }}
{% endif %}
{{ form.non_field_errors }}
- {% if form.connections|length > 1 and can_change %}
+ {% if can_change %}