This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
200 lines (170 loc) · 5.98 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
# -*- encoding: utf-8 -*-
import os
from wafer.settings import *
try:
from localsettings import *
except ImportError:
pass
from django.utils.translation import ugettext_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": "twitter",
"label": "Twitter",
"image": "/static/img/twitter.png",
"url": "https://twitter.com/pyconza",
},
)
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 main_conference_tickets_sold():
""" Return number of tickets sold for the main conference. """
from wafer.tickets.models import Ticket, TicketType
TUTORIAL_TICKET_TYPES = []
tutorial_type_ids = TicketType.objects.filter(
name__in=TUTORIAL_TICKET_TYPES)
return Ticket.objects.exclude(type_id__in=tutorial_type_ids).count()
def main_conference_tickets_remaining():
""" Return number of main conference tickets remaining. """
return max(0, 250 - main_conference_tickets_sold())
def early_bird_tickets_remaining():
""" Return number of early bird tickets remaining. """
early_bird_ticket_types = [
"Student (Early Bird)",
"Individual (Early Bird)",
"Corporate (Early Bird)",
"Pensioner (Early Bird)",
]
return max(0, 250 - tickets_sold(early_bird_ticket_types))
CRISPY_TEMPLATE_PACK = "bootstrap4"
MARKITUP_FILTER = (
"markdown.markdown",
{
"safe_mode": False,
"extensions": [
"mdx_outline",
"attr_list",
"mdx_attr_cols",
"markdown.extensions.tables",
"markdown.extensions.codehilite",
"mdx_variables",
],
"extension_configs": {
"mdx_variables": {
"vars": {
"main_conference_tickets_sold":
main_conference_tickets_sold,
"main_conference_tickets_remaining":
main_conference_tickets_remaining,
"early_bird_tickets_remaining":
early_bird_tickets_remaining,
}
}
},
},
)
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 = False
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'