Skip to content

Commit f045b47

Browse files
authored
Merge pull request #289 from hackupc/FIX/pdf_view
FIx: PDF, Phone hacker, checkbox order
2 parents 458d4d6 + 516d312 commit f045b47

File tree

7 files changed

+29
-37
lines changed

7 files changed

+29
-37
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ ENV PYTHONUNBUFFERED 1
88

99
# Upgrade pip before installing dependencies
1010
RUN pip install --upgrade pip
11-
COPY --chown=biene:biene requirements.txt requirements.txt
11+
COPY requirements.txt requirements.txt
1212
# Add bin to path to avoid wanring
1313
ENV PATH="/home/biene/.local/bin:${PATH}"
1414
# Disable cache because it won't be used because it will be installed only when creating image
1515
RUN pip install --no-cache-dir -r requirements.txt
1616

1717
# Mounts the application code to the image
18-
COPY --chown=biene:biene . code
18+
COPY . code
1919
WORKDIR /code
2020

2121
# Generate static files in the container

app/hackathon_variables.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
HACKATHON_GITHUB_REPO = 'https://github.com/hackupc/myhackupc/'
4141

4242
# (OPTIONAL) Applications deadline
43-
HACKATHON_APP_DEADLINE = timezone.datetime(2023, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
44-
VOLUNTEER_APP_DEADLINE = timezone.datetime(2023, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
45-
MENTOR_APP_DEADLINE = timezone.datetime(2023, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
43+
HACKATHON_APP_DEADLINE = timezone.datetime(2024, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
44+
VOLUNTEER_APP_DEADLINE = timezone.datetime(2024, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
45+
MENTOR_APP_DEADLINE = timezone.datetime(2024, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
4646
# (OPTIONAL) Online checkin activated
47-
ONLINE_CHECKIN = timezone.datetime(2022, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
47+
ONLINE_CHECKIN = timezone.datetime(2024, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
4848
# (OPTIONAL) When to arrive at the hackathon
4949
HACKATHON_ARRIVE = ''
5050

app/utils.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ def validate_url(data, query):
171171
:return:
172172
"""
173173
if data and query not in data:
174-
raise forms.ValidationError("Please enter a valid {} url".format(query))
174+
if query:
175+
query += " "
176+
raise forms.ValidationError("Enter a valid {}URL.".format(query))
175177

176178

177179
@keep_lazy_text
@@ -240,7 +242,7 @@ def generateGTicketUrl(qrValue: str):
240242
{
241243
"header": "Disclaimer",
242244
"body": "This is a copy of the official ticket, do not treat this as the official ticket "
243-
"since it is not updated in real time.",
245+
"since it is not updated in real time.",
244246
"id": "TEXT_MODULE_ID",
245247
}
246248
],
@@ -289,9 +291,7 @@ def generateGTicketUrl(qrValue: str):
289291
}
290292

291293
generic.create_object(issuer_id, objSufix, cardObject)
292-
return generic.create_jwt_new_objects(
293-
issuer_id, class_suffix, cardObject
294-
)
294+
return generic.create_jwt_new_objects(issuer_id, class_suffix, cardObject)
295295

296296

297297
#
@@ -311,6 +311,7 @@ def generateGTicketUrl(qrValue: str):
311311
# the License.
312312
#
313313

314+
314315
class GenericPass:
315316
"""Class for creating and managing Generic passes in Google Wallet.
316317
@@ -348,10 +349,7 @@ def auth(self):
348349

349350
# [START createObject]
350351
def create_object(
351-
self,
352-
issuer_id: str,
353-
object_suffix: str,
354-
cardObject: dict
352+
self, issuer_id: str, object_suffix: str, cardObject: dict
355353
) -> str:
356354
"""Create an object.
357355

applications/forms/base.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
import os
22
import json
33
from django import forms
44
from django.conf import settings
@@ -41,7 +41,10 @@ def get_exclude_fields():
4141
class _BaseApplicationForm(OverwriteOnlyModelFormMixin, BootstrapFormMixin, ModelForm):
4242
diet = forms.ChoiceField(label='Dietary requirements', choices=models.DIETS, required=True)
4343
phone_number = forms.CharField(required=False, widget=forms.TextInput(
44-
attrs={'class': 'form-control', 'placeholder': '+#########'}))
44+
attrs={'class': 'form-control', 'placeholder': '+#########'}),
45+
label='Phone number (Optional)',
46+
help_text='This field is not mandatory.'
47+
)
4548
under_age = forms.TypedChoiceField(
4649
required=True,
4750
label='How old will you be at time of the event?',
@@ -52,7 +55,7 @@ class _BaseApplicationForm(OverwriteOnlyModelFormMixin, BootstrapFormMixin, Mode
5255
)
5356

5457
terms_and_conditions = forms.BooleanField(
55-
required=False,
58+
required=True,
5659
label='I\'ve read, understand and accept <a href="/terms_and_conditions" target="_blank">%s '
5760
'Terms & Conditions</a> and <a href="/privacy_and_cookies" target="_blank">%s '
5861
'Privacy and Cookies Policy</a>.<span style="color: red; font-weight: bold;"> *</span>' % (
@@ -112,9 +115,9 @@ def clean_origin(self):
112115
origin = self.cleaned_data['origin']
113116
# read from json file on local machine
114117

115-
# actual file path
118+
# actual file path
116119
dir_path = os.path.dirname(os.path.realpath(__file__))
117-
120+
118121
# get static relative path
119122
STATIC_ROOT = os.path.join(dir_path, "../static")
120123

applications/forms/common_fields.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def common_degree():
3434
)
3535

3636

37+
3738
def social_media_field(field_name, placeholder):
3839
return forms.CharField(
3940
required=False,

applications/forms/hacker.py

+6-17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class HackerApplicationForm(_BaseApplicationForm):
1111
{"name": "graduation_year", "space": 12},
1212
{"name": "gender", "space": 12},
1313
{"name": "other_gender", "space": 12},
14+
{"name": "phone_number", "space": 12},
1415
{"name": "tshirt_size", "space": 12},
1516
{"name": "under_age", "space": 12},
1617
{"name": "lennyface", "space": 12},
@@ -78,6 +79,7 @@ def clean_projects(self):
7879
)
7980
return data
8081

82+
8183
first_timer = common_first_timer()
8284

8385
university = common_university()
@@ -127,20 +129,6 @@ def clean_cvs_edition(self):
127129
cc = self.cleaned_data.get("cvs_edition", False)
128130
return cc
129131

130-
def clean_resume(self):
131-
resume = self.cleaned_data["resume"]
132-
size = getattr(resume, "_size", 0)
133-
if size > settings.MAX_UPLOAD_SIZE:
134-
raise forms.ValidationError(
135-
"Please keep resume size under %s. Current filesize %s!"
136-
% (filesizeformat(settings.MAX_UPLOAD_SIZE), filesizeformat(size))
137-
)
138-
if not resume and not self.instance.pk:
139-
raise forms.ValidationError(
140-
"In order to apply and attend you have to provide a resume."
141-
)
142-
return resume
143-
144132
def clean_reimb_amount(self):
145133
data = self.cleaned_data["reimb_amount"]
146134
reimb = self.cleaned_data.get("reimb", False)
@@ -174,9 +162,9 @@ def get_bootstrap_field_info(self):
174162
if not hybrid:
175163
self.fields["online"].widget = forms.HiddenInput()
176164
polices_fields = [
177-
{"name": "terms_and_conditions", "space": 12},
178165
{"name": "cvs_edition", "space": 12},
179166
{"name": "email_subscribe", "space": 12},
167+
{"name": "terms_and_conditions", "space": 12},
180168
]
181169
if not discord:
182170
personal_info_fields.extend(
@@ -227,7 +215,7 @@ class Meta(_BaseApplicationForm.Meta):
227215
"resume": "Accepted file formats: %s"
228216
% (", ".join(extensions) if extensions else "Any"),
229217
"origin": "If you don’t see your city, choose the closest one! "
230-
"Plase type following this schema: <strong>city, province, country</strong>",
218+
"Please type following this schema: <strong>city, province, country</strong>",
231219
}
232220

233221
class CustomSelect(forms.Select):
@@ -272,7 +260,8 @@ def clean_discover(self):
272260
"graduation_year": "What year are you expecting to graduate?",
273261
"tshirt_size": "What's your t-shirt size?",
274262
"diet": "Dietary requirements",
275-
"lennyface": 'Describe yourself with a "lenny face":',
263+
"phone_number": "Phone number (Optional)",
264+
"lennyface": 'Which "lenny face" represents you better?',
276265
"discover": "How did you hear about us?",
277266
"origin": "Where are you joining us from?",
278267
"description": "Why are you excited about %s?" % settings.HACKATHON_NAME,

organizers/templates/pdf_view.html

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{% block body_plain %}
77
<div id="content-pdf" style="width: 100%; text-align: center">
88
<button class="btn btn-default btn-block" style="width: 90%; display: inline" onclick="download()">Download</button>
9+
<button class="btn btn-default btn-block" style="width: 90%; display: inline" onclick="close_tab();">Close tab</button>
910
<div id="pdf-div" style="width: 100%; text-align:center; margin-top: 5px">
1011

1112
</div>

0 commit comments

Comments
 (0)