hidden sftpuser in webalizer form
This commit is contained in:
parent
5b5bb2fe22
commit
ca9dcceb88
|
@ -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')
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue