mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
- ugettext functions will be removed in Django 4.0. Each use emits a warning when running with Django 3.2. Since we have warnings enabled in developer mode, we see quite a few messages because of this. - ugettext is already a simple alias of gettext. So, no regressions are expected. Tests: - Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine. - Using Django 3.2 there are no warnings related to removal of ugettext functions. - Ran regular unit tests. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
from django import http
|
|
from django.urls import reverse
|
|
from django.utils.translation import gettext as _
|
|
from django.views.generic import TemplateView
|
|
from django.views.generic.edit import FormView
|
|
|
|
from plinth.modules import first_boot
|
|
|
|
from .forms import FirstbootWizardSecretForm
|
|
|
|
|
|
class WelcomeView(FormView):
|
|
"""Show the welcome screen."""
|
|
form_class = FirstbootWizardSecretForm
|
|
template_name = 'firstboot_welcome.html'
|
|
|
|
def form_valid(self, form):
|
|
"""If form is valid, mark this step as done and move to next step."""
|
|
self.request.session['firstboot_secret_provided'] = True
|
|
first_boot.mark_step_done('firstboot_welcome')
|
|
return http.HttpResponseRedirect(reverse(first_boot.next_step()))
|
|
|
|
def get_context_data(self, **kwargs):
|
|
"""Add network connections to context list."""
|
|
context = super().get_context_data(**kwargs)
|
|
show_prompt = first_boot.firstboot_wizard_secret_exists()
|
|
context['show_wizard_password_prompt'] = show_prompt
|
|
return context
|
|
|
|
|
|
class CompleteView(TemplateView):
|
|
"""Show summary after all firstboot setup is done.
|
|
|
|
After viewing this page the firstboot module can't be accessed anymore.
|
|
"""
|
|
|
|
template_name = 'firstboot_complete.html'
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
"""Mark as done as soon as page is served."""
|
|
response = super().get(self, request, *args, **kwargs)
|
|
first_boot.mark_step_done('firstboot_complete')
|
|
return response
|
|
|
|
def get_context_data(self, **kwargs):
|
|
"""Add network connections to context list."""
|
|
context = super().get_context_data(**kwargs)
|
|
context['title'] = _('Setup Complete')
|
|
context['firstboot_complete'] = True
|
|
return context
|