-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhooks.py
More file actions
99 lines (86 loc) · 2.43 KB
/
hooks.py
File metadata and controls
99 lines (86 loc) · 2.43 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
from django.template.loader import render_to_string
from plugins.apc import plugin_settings
from utils import setting_handler
from submission import models as submission_models
def publication_fees(context):
plugin = plugin_settings.get_self()
request = context['request']
enable_apcs = setting_handler.get_plugin_setting(
plugin,
'enable_apcs',
request.journal,
create=True,
pretty='Enable APCs',
)
track_apcs = setting_handler.get_plugin_setting(
plugin,
'track_apcs',
request.journal,
create=True,
pretty='Track APCs',
)
sections = submission_models.Section.objects.filter(
journal=request.journal,
public_submissions=True,
).prefetch_related('sectionapc')
if track_apcs.value == 'on':
return ''
elif enable_apcs.value == 'on':
return render_to_string(
'apc/publication_fees.html',
{'sections': sections},
)
return ''
def waiver_info(context):
plugin = plugin_settings.get_self()
request = context['request']
waiver_text = setting_handler.get_plugin_setting(
plugin,
'waiver_text',
request.journal,
create=True,
pretty='Waiver Text',
)
enable_waivers = setting_handler.get_plugin_setting(
plugin,
'enable_waivers',
request.journal,
create=True,
pretty='Enable Waivers',
)
if enable_waivers.value == 'on':
return render_to_string(
'apc/waiver_info.html',
{'request': request, 'waiver_text': waiver_text.value},
)
else:
return ''
def waiver_application(context):
plugin = plugin_settings.get_self()
request = context['request']
article = context['article']
waiver_text = setting_handler.get_plugin_setting(
plugin,
'waiver_text',
request.journal,
create=True,
pretty='Waiver Text',
)
enable_waivers = setting_handler.get_plugin_setting(
plugin,
'enable_waivers',
request.journal,
create=True,
pretty='Enable Waivers',
)
if enable_waivers.value == 'on':
return render_to_string(
'apc/article_waiver_app.html',
{
'request': request,
'waiver_text': waiver_text.value,
'article': article,
},
)
else:
return ''