filter servers on websites, show only webservers

This commit is contained in:
Jorge Pastor 2023-12-19 10:04:10 +01:00
parent f7a4fc749b
commit b782269b12
2 changed files with 12 additions and 2 deletions

View File

@ -7,9 +7,18 @@ from orchestra.contrib.webapps.models import WebApp
from .utils import normurlpath from .utils import normurlpath
from .validators import validate_domain_protocol, validate_server_name from .validators import validate_domain_protocol, validate_server_name
from orchestra.settings import WEB_SERVERS
class WebsiteAdminForm(forms.ModelForm): 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): def clean(self):
""" Prevent multiples domains on the same protocol """ """ Prevent multiples domains on the same protocol """
super(WebsiteAdminForm, self).clean() super(WebsiteAdminForm, self).clean()

View File

@ -99,7 +99,8 @@ NEW_SERVERS = Setting('NEW_SERVERS',
) )
) )
WEB_SERVERS = Setting('WEBAPPS_SERVERS', ( WEB_SERVERS = Setting('WEB_SERVERS', (
'wpmu',
'web.pangea.lan', 'web.pangea.lan',
'web-ng', 'web-ng',
'web-11.pangea.lan', 'web-11.pangea.lan',