##// END OF EJS Templates
Removed old maintenance module, that was used prior to data migrations. Cleaned up requirements. Minor fix in the tag model
Removed old maintenance module, that was used prior to data migrations. Cleaned up requirements. Minor fix in the tag model

File last commit:

r730:447bb8d7 2.0-dev
r731:f96ca2ca 2.0-dev
Show More
settings.py
35 lines | 1.1 KiB | text/x-python | PythonLexer
from django.db import transaction
from django.shortcuts import render, redirect
from boards.abstracts.settingsmanager import get_settings_manager
from boards.views.base import BaseBoardView, CONTEXT_FORM
from boards.forms import SettingsForm, PlainErrorList
class SettingsView(BaseBoardView):
def get(self, request):
context = self.get_context_data(request=request)
settings_manager = get_settings_manager(request)
selected_theme = settings_manager.get_theme()
form = SettingsForm(initial={'theme': selected_theme},
error_class=PlainErrorList)
context[CONTEXT_FORM] = form
return render(request, 'boards/settings.html', context)
def post(self, request):
settings_manager = get_settings_manager(request)
with transaction.atomic():
form = SettingsForm(request.POST, error_class=PlainErrorList)
if form.is_valid():
selected_theme = form.cleaned_data['theme']
settings_manager.set_theme(selected_theme)
return redirect('settings')