-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin_settings.py
executable file
·70 lines (54 loc) · 1.8 KB
/
plugin_settings.py
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
from utils import plugins
from utils.install import update_settings
from events import logic as events_logic
from django.core.management import call_command
from django.conf import settings
PLUGIN_NAME = 'Consortial Billing'
DISPLAY_NAME = 'Supporters'
SHORT_NAME = 'consortial_billing'
MANAGER_URL = 'supporters_manager'
DESCRIPTION = 'This plugin helps presses manage consortial support'
AUTHOR = 'Open Library of Humanities'
VERSION = '2.3.3'
JANEWAY_VERSION = "1.7"
IS_WORKFLOW_PLUGIN = False
ON_SIGNUP = "on_signup"
RATE_INDICATOR = 'PA.NUS.FCRF'
DISPARITY_INDICATOR = 'NY.GNP.PCAP.CD'
class ConsortialBillingPlugin(plugins.Plugin):
plugin_name = PLUGIN_NAME
display_name = DISPLAY_NAME
description = DESCRIPTION
author = AUTHOR
short_name = SHORT_NAME
manager_url = MANAGER_URL
version = VERSION
janeway_version = JANEWAY_VERSION
is_workflow_plugin = IS_WORKFLOW_PLUGIN
press_wide = True
def install(fetch_data=False):
ConsortialBillingPlugin.install()
update_settings(
file_path=f'plugins/{SHORT_NAME}/install/settings.json'
)
if fetch_data and not settings.IN_TEST_RUNNER:
call_command('fetch_world_bank_data', RATE_INDICATOR)
call_command('fetch_world_bank_data', DISPARITY_INDICATOR)
def hook_registry():
return {
'press_admin_nav_block': {
'module': 'plugins.consortial_billing.hooks',
'function': 'admin_hook'
},
}
def register_for_events():
# Plugin modules can't be imported until plugin is loaded
from plugins.consortial_billing.notifications import emails
events_logic.Events.register_for_event(
ON_SIGNUP,
emails.email_agent_about_signup,
)
events_logic.Events.register_for_event(
ON_SIGNUP,
emails.email_supporter_to_confirm,
)