blob: 877ad0104e7bc103efa7f3b7a1ff30067d547bec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
from django.utils.decorators import method_decorator
from django.views.generic import RedirectView
from core.models import Config
from users.decorators import identity_required
from users.views.admin import AdminSettingsPage
@method_decorator(identity_required, name="dispatch")
class SettingsRoot(RedirectView):
url = "/settings/interface/"
class SettingsPage(AdminSettingsPage):
"""
Shows a settings page dynamically created from our settings layout
at the bottom of the page. Don't add this to a URL directly - subclass!
"""
options_class = Config.IdentityOptions
template_name = "settings/settings.html"
def load_config(self):
return Config.load_identity(self.request.identity)
def save_config(self, key, value):
Config.set_identity(self.request.identity, key, value)
class InterfacePage(SettingsPage):
section = "interface"
options = {
"toot_mode": {
"title": "I Will Toot As I Please",
"help_text": "If enabled, changes all 'Post' buttons to 'Toot!'",
}
}
|