Skip to content

Commit

Permalink
Merge pull request #289 from hackupc/FIX/pdf_view
Browse files Browse the repository at this point in the history
FIx: PDF, Phone hacker, checkbox order
  • Loading branch information
EncryptEx authored Feb 14, 2024
2 parents 458d4d6 + 516d312 commit f045b47
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ ENV PYTHONUNBUFFERED 1

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

# Mounts the application code to the image
COPY --chown=biene:biene . code
COPY . code
WORKDIR /code

# Generate static files in the container
Expand Down
8 changes: 4 additions & 4 deletions app/hackathon_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
HACKATHON_GITHUB_REPO = 'https://github.com/hackupc/myhackupc/'

# (OPTIONAL) Applications deadline
HACKATHON_APP_DEADLINE = timezone.datetime(2023, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2023, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2023, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
HACKATHON_APP_DEADLINE = timezone.datetime(2024, 5, 3, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2024, 5, 9, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2024, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) Online checkin activated
ONLINE_CHECKIN = timezone.datetime(2022, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
ONLINE_CHECKIN = timezone.datetime(2024, 4, 29, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) When to arrive at the hackathon
HACKATHON_ARRIVE = ''

Expand Down
16 changes: 7 additions & 9 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def validate_url(data, query):
:return:
"""
if data and query not in data:
raise forms.ValidationError("Please enter a valid {} url".format(query))
if query:
query += " "
raise forms.ValidationError("Enter a valid {}URL.".format(query))


@keep_lazy_text
Expand Down Expand Up @@ -240,7 +242,7 @@ def generateGTicketUrl(qrValue: str):
{
"header": "Disclaimer",
"body": "This is a copy of the official ticket, do not treat this as the official ticket "
"since it is not updated in real time.",
"since it is not updated in real time.",
"id": "TEXT_MODULE_ID",
}
],
Expand Down Expand Up @@ -289,9 +291,7 @@ def generateGTicketUrl(qrValue: str):
}

generic.create_object(issuer_id, objSufix, cardObject)
return generic.create_jwt_new_objects(
issuer_id, class_suffix, cardObject
)
return generic.create_jwt_new_objects(issuer_id, class_suffix, cardObject)


#
Expand All @@ -311,6 +311,7 @@ def generateGTicketUrl(qrValue: str):
# the License.
#


class GenericPass:
"""Class for creating and managing Generic passes in Google Wallet.
Expand Down Expand Up @@ -348,10 +349,7 @@ def auth(self):

# [START createObject]
def create_object(
self,
issuer_id: str,
object_suffix: str,
cardObject: dict
self, issuer_id: str, object_suffix: str, cardObject: dict
) -> str:
"""Create an object.
Expand Down
13 changes: 8 additions & 5 deletions applications/forms/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import os
import json
from django import forms
from django.conf import settings
Expand Down Expand Up @@ -41,7 +41,10 @@ def get_exclude_fields():
class _BaseApplicationForm(OverwriteOnlyModelFormMixin, BootstrapFormMixin, ModelForm):
diet = forms.ChoiceField(label='Dietary requirements', choices=models.DIETS, required=True)
phone_number = forms.CharField(required=False, widget=forms.TextInput(
attrs={'class': 'form-control', 'placeholder': '+#########'}))
attrs={'class': 'form-control', 'placeholder': '+#########'}),
label='Phone number (Optional)',
help_text='This field is not mandatory.'
)
under_age = forms.TypedChoiceField(
required=True,
label='How old will you be at time of the event?',
Expand All @@ -52,7 +55,7 @@ class _BaseApplicationForm(OverwriteOnlyModelFormMixin, BootstrapFormMixin, Mode
)

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

# actual file path
# actual file path
dir_path = os.path.dirname(os.path.realpath(__file__))

# get static relative path
STATIC_ROOT = os.path.join(dir_path, "../static")

Expand Down
1 change: 1 addition & 0 deletions applications/forms/common_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def common_degree():
)



def social_media_field(field_name, placeholder):
return forms.CharField(
required=False,
Expand Down
23 changes: 6 additions & 17 deletions applications/forms/hacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class HackerApplicationForm(_BaseApplicationForm):
{"name": "graduation_year", "space": 12},
{"name": "gender", "space": 12},
{"name": "other_gender", "space": 12},
{"name": "phone_number", "space": 12},
{"name": "tshirt_size", "space": 12},
{"name": "under_age", "space": 12},
{"name": "lennyface", "space": 12},
Expand Down Expand Up @@ -78,6 +79,7 @@ def clean_projects(self):
)
return data


first_timer = common_first_timer()

university = common_university()
Expand Down Expand Up @@ -127,20 +129,6 @@ def clean_cvs_edition(self):
cc = self.cleaned_data.get("cvs_edition", False)
return cc

def clean_resume(self):
resume = self.cleaned_data["resume"]
size = getattr(resume, "_size", 0)
if size > settings.MAX_UPLOAD_SIZE:
raise forms.ValidationError(
"Please keep resume size under %s. Current filesize %s!"
% (filesizeformat(settings.MAX_UPLOAD_SIZE), filesizeformat(size))
)
if not resume and not self.instance.pk:
raise forms.ValidationError(
"In order to apply and attend you have to provide a resume."
)
return resume

def clean_reimb_amount(self):
data = self.cleaned_data["reimb_amount"]
reimb = self.cleaned_data.get("reimb", False)
Expand Down Expand Up @@ -174,9 +162,9 @@ def get_bootstrap_field_info(self):
if not hybrid:
self.fields["online"].widget = forms.HiddenInput()
polices_fields = [
{"name": "terms_and_conditions", "space": 12},
{"name": "cvs_edition", "space": 12},
{"name": "email_subscribe", "space": 12},
{"name": "terms_and_conditions", "space": 12},
]
if not discord:
personal_info_fields.extend(
Expand Down Expand Up @@ -227,7 +215,7 @@ class Meta(_BaseApplicationForm.Meta):
"resume": "Accepted file formats: %s"
% (", ".join(extensions) if extensions else "Any"),
"origin": "If you don’t see your city, choose the closest one! "
"Plase type following this schema: <strong>city, province, country</strong>",
"Please type following this schema: <strong>city, province, country</strong>",
}

class CustomSelect(forms.Select):
Expand Down Expand Up @@ -272,7 +260,8 @@ def clean_discover(self):
"graduation_year": "What year are you expecting to graduate?",
"tshirt_size": "What's your t-shirt size?",
"diet": "Dietary requirements",
"lennyface": 'Describe yourself with a "lenny face":',
"phone_number": "Phone number (Optional)",
"lennyface": 'Which "lenny face" represents you better?',
"discover": "How did you hear about us?",
"origin": "Where are you joining us from?",
"description": "Why are you excited about %s?" % settings.HACKATHON_NAME,
Expand Down
1 change: 1 addition & 0 deletions organizers/templates/pdf_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{% block body_plain %}
<div id="content-pdf" style="width: 100%; text-align: center">
<button class="btn btn-default btn-block" style="width: 90%; display: inline" onclick="download()">Download</button>
<button class="btn btn-default btn-block" style="width: 90%; display: inline" onclick="close_tab();">Close tab</button>
<div id="pdf-div" style="width: 100%; text-align:center; margin-top: 5px">

</div>
Expand Down

0 comments on commit f045b47

Please sign in to comment.