mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
module.app property usage is greatly reduced because setup() and force_upgrade() method are now part of App class instead of at the module level. Remove the remaining minor cases of usage and drop the property altogether. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
32 lines
1021 B
Python
32 lines
1021 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
from django.contrib import messages
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from plinth import app as app_module
|
|
from plinth.forms import TLSDomainForm
|
|
from plinth.modules import quassel
|
|
from plinth.views import AppView
|
|
|
|
|
|
class QuasselAppView(AppView):
|
|
app_id = 'quassel'
|
|
form_class = TLSDomainForm
|
|
|
|
def get_initial(self):
|
|
"""Return the values to fill in the form."""
|
|
initial = super().get_initial()
|
|
initial['domain'] = quassel.get_domain()
|
|
return initial
|
|
|
|
def form_valid(self, form):
|
|
"""Change the access control of Radicale service."""
|
|
data = form.cleaned_data
|
|
if quassel.get_domain() != data['domain']:
|
|
quassel.set_domain(data['domain'])
|
|
app = app_module.App.get('quassel')
|
|
app.get_component('letsencrypt-quassel').setup_certificates()
|
|
messages.success(self.request, _('Configuration updated'))
|
|
|
|
return super().form_valid(form)
|