From 9f50bcc672e494554cfdb19f74c42f5b955c10f0 Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Thu, 24 Aug 2023 12:39:59 +0200 Subject: [PATCH] hidden sftpuser in webalizer form --- orchestra/contrib/webapps/types/misc.py | 3 ++- orchestra/plugins/forms.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/orchestra/contrib/webapps/types/misc.py b/orchestra/contrib/webapps/types/misc.py index 92fd1fa3..d80a66b8 100644 --- a/orchestra/contrib/webapps/types/misc.py +++ b/orchestra/contrib/webapps/types/misc.py @@ -3,7 +3,7 @@ import os from django import forms from django.utils.translation import gettext_lazy as _ from rest_framework import serializers -from orchestra.plugins.forms import ExtendedPluginDataForm +from orchestra.plugins.forms import ExtendedPluginDataForm, PluginDataForm from ..options import AppOption from . import AppType @@ -32,6 +32,7 @@ class WebalizerApp(AppType): "Statistics will be collected once this app is mounted into one or more Websites.") icon = 'orchestra/icons/apps/Stats.png' option_groups = () + form = PluginDataForm def get_directive(self): webalizer_path = os.path.join(self.instance.get_path(), '%(site_name)s') diff --git a/orchestra/plugins/forms.py b/orchestra/plugins/forms.py index 1cbdd84d..cbd71489 100644 --- a/orchestra/plugins/forms.py +++ b/orchestra/plugins/forms.py @@ -25,9 +25,11 @@ class PluginForm(forms.ModelForm): class PluginDataForm(PluginForm): data = forms.CharField(widget=forms.HiddenInput, required=False) + target_server = forms.ModelChoiceField(queryset=Server.objects.filter(name__in=WEB_SERVERS),) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.fields['sftpuser'].widget = forms.HiddenInput() if self.instance: for field in self.declared_fields: initial = self.fields[field].initial @@ -99,11 +101,8 @@ class ExtendedPluginDataForm(PluginDataForm): widget=forms.PasswordInput, help_text=_("Enter the same password as above, for verification.")) - target_server = forms.ModelChoiceField(queryset=Server.objects.filter(name__in=WEB_SERVERS),) - def __init__(self, *args, **kwargs): super(ExtendedPluginDataForm, self).__init__(*args, **kwargs) - self.fields['sftpuser'].widget = forms.HiddenInput() if self.instance.id is not None: self.fields['username'].widget = forms.HiddenInput() self.fields['password1'].widget = forms.HiddenInput()