From b782269b12aacc6a5eb79642be86966d0c9e11f5 Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Tue, 19 Dec 2023 10:04:10 +0100 Subject: [PATCH] filter servers on websites, show only webservers --- orchestra/contrib/websites/forms.py | 11 ++++++++++- orchestra/settings.py | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/orchestra/contrib/websites/forms.py b/orchestra/contrib/websites/forms.py index 2df37fd0..f8e04d70 100644 --- a/orchestra/contrib/websites/forms.py +++ b/orchestra/contrib/websites/forms.py @@ -7,9 +7,18 @@ from orchestra.contrib.webapps.models import WebApp from .utils import normurlpath from .validators import validate_domain_protocol, validate_server_name - +from orchestra.settings import WEB_SERVERS class WebsiteAdminForm(forms.ModelForm): + + def __init__(self, *args, **kwargs): + super(WebsiteAdminForm, self).__init__(*args, **kwargs) + if self.instance.id is None: + qsServer = self.fields['target_server'].queryset.filter(name__in=WEB_SERVERS) + else: + qsServer = self.fields['target_server'].queryset.filter(id=self.instance.target_server_id) + self.fields['target_server'].queryset = qsServer + def clean(self): """ Prevent multiples domains on the same protocol """ super(WebsiteAdminForm, self).clean() diff --git a/orchestra/settings.py b/orchestra/settings.py index 400b679e..9c1940cd 100644 --- a/orchestra/settings.py +++ b/orchestra/settings.py @@ -99,7 +99,8 @@ NEW_SERVERS = Setting('NEW_SERVERS', ) ) -WEB_SERVERS = Setting('WEBAPPS_SERVERS', ( +WEB_SERVERS = Setting('WEB_SERVERS', ( + 'wpmu', 'web.pangea.lan', 'web-ng', 'web-11.pangea.lan',