-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
227 lines (194 loc) · 6.68 KB
/
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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# -*- encoding: utf-8 -*-
import os
from wafer.settings import *
try:
from localsettings import *
except ImportError:
pass
from django.utils.translation import gettext_lazy as _
from django.urls import reverse_lazy
pyconzadir = os.path.dirname(__file__)
STATICFILES_DIRS = (os.path.join(pyconzadir, "static"),)
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
TEMPLATES[0]["DIRS"] = (os.path.join(pyconzadir, "templates"),) + TEMPLATES[0]["DIRS"]
WAFER_MENUS += (
{"menu": "about", "label": _("About"), "items": []},
{"menu": "venue", "label": _("Venue"), "items": []},
{"menu": "tickets", "label": _("Tickets"), "items": []},
{"menu": "sponsors", "label": _("Sponsors"), "items": []},
{
"menu": "talks",
"label": _("Talks"),
"items": [
{
"name": "schedule", "label": _("Schedule"),
"url": reverse_lazy("wafer_full_schedule"),
},
{
"name": "accepted-talks",
"label": _("Accepted Talks"),
"url": reverse_lazy("wafer_users_talks"),
},
{
"name": "speakers",
"label": _("Speakers"),
"url": reverse_lazy("wafer_talks_speakers"),
},
],
},
{"menu": "news", "label": _("News"), "items": []},
{
"menu": "previous-pycons",
"label": _("Past PyConZAs"),
"items": [
{
"name": "pyconza2012",
"label": _("PyConZA 2012"),
"url": "https://2012.za.pycon.org/",
},
{
"name": "pyconza2013",
"label": _("PyConZA 2013"),
"url": "https://2013.za.pycon.org/",
},
{
"name": "pyconza2014",
"label": _("PyConZA 2014"),
"url": "https://2014.za.pycon.org/",
},
{
"name": "pyconza2015",
"label": _("PyConZA 2015"),
"url": "https://2015.za.pycon.org/",
},
{
"name": "pyconza2016",
"label": _("PyConZA 2016"),
"url": "https://2016.za.pycon.org/",
},
{
"name": "pyconza2017",
"label": _("PyConZA 2017"),
"url": "https://2017.za.pycon.org/",
},
{
"name": "pyconza2018",
"label": _("PyConZA 2018"),
"url": "https://2018.za.pycon.org/",
},
{
"name": "pyconza2019",
"label": _("PyConZA 2019"),
"url": "https://2019.za.pycon.org/",
},
{
"name": "pyconza2020",
"label": _("PyConZA 2020"),
"url": "https://2020.za.pycon.org/",
},
{
"name": "pyconza2021",
"label": _("PyConZA 2021"),
"url": "https://2021.za.pycon.org/",
},
{
"name": "pyconza2022",
"label": _("PyConZA 2022"),
"url": "https://2022.za.pycon.org/",
},
],
},
{
"name": "twitter",
"label": "Twitter",
"image": "/static/img/twitter.svg",
"url": "https://twitter.com/pyconza",
},
{
"name": "mastodon",
"label": "Mastodon",
"image": "/static/img/mastodon.svg",
"url": "https://fosstodon.org/@pyconza",
},
)
_TICKET_TIERS = ("Student", "Pensioner", "Individual", "Corporate", "Sponsored")
_DURBAN_TICKET_TYPES = [
f"{tier} ({kind})"
for tier in _TICKET_TIERS
for kind in ("Durban", "Durban, Early Bird")
]
_ONLINE_TICKET_TYPES = [
f"{tier} ({kind})"
for tier in _TICKET_TIERS
for kind in ("Online", "Online, Early Bird")
]
_TUTORIAL_AIRFLOW_TICKET_TYPES = [
'Airflow - beyond the basics (and also some basics) (Durban)'
]
def tickets_sold(ticket_types):
""" Return number of tickets sold. """
from wafer.tickets.models import Ticket, TicketType
ticket_type_ids = TicketType.objects.filter(name__in=ticket_types)
return Ticket.objects.filter(type_id__in=ticket_type_ids).count()
def durban_tickets_sold():
""" Number of tickets sold for the Durban in-person conference. """
return tickets_sold(_DURBAN_TICKET_TYPES)
def durban_tickets_remaining():
""" Number of tickets remaining for the Durban in-person conference. """
return max(0, 100 - durban_tickets_sold())
def online_tickets_sold():
""" Number of tickets sold for the online conference. """
return tickets_sold(_ONLINE_TICKET_TYPES)
def tutorial_airflow_tickets_sold():
""" Number of tickets sold for the devops tutorial. """
return tickets_sold(_TUTORIAL_AIRFLOW_TICKET_TYPES)
CRISPY_TEMPLATE_PACK = "bootstrap5"
MARKITUP_FILTER = (
"markdown.markdown",
{
"safe_mode": False,
"extensions": [
"mdx_outline",
"attr_list",
"mdx_attr_cols",
"markdown.extensions.tables",
"markdown.extensions.codehilite",
"mdx_variables",
"mdx_staticfiles",
],
"extension_configs": {
"mdx_variables": {
"vars": {
"durban_tickets_sold": durban_tickets_sold,
"durban_tickets_remaining": durban_tickets_remaining,
"online_tickets_sold": online_tickets_sold,
"tutorial_airflow_tickets_sold": (
tutorial_airflow_tickets_sold
),
}
}
},
},
)
WAFER_PAGE_MARKITUP_FILTER = MARKITUP_FILTER
# Talks submissions are open
WAFER_TALKS_OPEN = True
# Set the timezone to the conference timezone
USE_TZ = True
TIME_ZONE = "Africa/Johannesburg"
# Default static and media locations - we rely on apache to redirect
# accordingly.
# These are named to not clash with the repo contents
STATIC_ROOT = os.path.join(pyconzadir, "localstatic")
MEDIA_ROOT = os.path.join(pyconzadir, "localmedia")
# Ticket sales are open
WAFER_REGISTRATION_OPEN = True
WAFER_REGISTRATION_MODE = "ticket"
# Point static mirror away from the default, which is relative to the
# wafer package
BUILD_DIR = os.path.join(pyconzadir, "mirror")
# Will be needed for the static site generation
# WAFER_HIDE_LOGIN = True
# Needed to add pyconza-funding app
# INSTALLED_APPS = ('pyconza.funding', ) + INSTALLED_APPS
# ROOT_URLCONF = 'urls'