-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.py
More file actions
31 lines (25 loc) · 847 Bytes
/
views.py
File metadata and controls
31 lines (25 loc) · 847 Bytes
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
from django.shortcuts import render, redirect
from django.urls import reverse
from plugins.annotators import plugin_settings
from utils import setting_handler
def index(request):
plugin = plugin_settings.AnnotatorsPlugin.get_self()
enable_hypothesis = setting_handler.get_plugin_setting(
plugin=plugin,
setting_name='enable_hypothesis',
journal=request.journal,
)
if request.POST:
hypothesis = request.POST.get('hypothesis')
setting_handler.save_plugin_setting(
plugin,
'enable_hypothesis',
hypothesis,
request.journal,
)
return redirect(reverse('annotators_index'))
template = 'annotators/index.html'
context = {
'enable_hypothesis': enable_hypothesis,
}
return render(request, template, context)