Joseph Nuthalapati aaea6bf00e
tt-rss: Allow selection of a domain name
Fixes: #2136

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[james: Fix comment]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-11-21 19:10:54 -05:00

29 lines
836 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.forms import TLSDomainForm
from plinth.modules import ttrss
from plinth.views import AppView
class TTRSSAppView(AppView):
app_id = 'ttrss'
form_class = TLSDomainForm
def get_initial(self):
"""Return the values to fill in the form."""
initial = super().get_initial()
initial['domain'] = ttrss.get_domain()
return initial
def form_valid(self, form):
"""Change the domain of TT-RSS app."""
data = form.cleaned_data
if ttrss.get_domain() != data['domain']:
ttrss.set_domain(data['domain'])
messages.success(self.request, _('Configuration updated'))
return super().form_valid(form)