Beispiel #1
0
def settings_historical_data(request):
    if request.method == 'POST':
        form = forms.SettingsHistoricalDataForm(request.POST)
        if form.is_valid():
            utils.set_setting('historical_retention', form.cleaned_data['days'])
            messages.success(request, 'Data retention settings saved.')

            return redirect('settings_page')

    else:
        return redirect('settings_page')
Beispiel #2
0
def settings_page(request):
    historical_setting = utils.get_setting('historical_retention')
    historical_setting_form = forms.SettingsHistoricalDataForm(initial={'days': historical_setting})

    senddata_setting = utils.get_setting('send_data')

    context = {
        'user': request.user,
        'request': request,
        'historical_setting_form': historical_setting_form,
        'senddata_setting': senddata_setting}
    return render(request, 'server/settings.html', context)