-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added permission slip to under age (#116)
* Added permission slip to under age * Add CI of python 3.10
- Loading branch information
1 parent
7ca431b
commit e978b19
Showing
32 changed files
with
589 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
HACKATHON_NAME = 'HackUPC' | ||
HACKATHON_DESCRIPTION = 'Join us for BarcelonaTech\'s hackathon. 36h.' | ||
HACKATHON_ORG = 'Hackers@UPC' | ||
HACKATHON_START_DATE = '12/12/2012' | ||
HACKATHON_END_DATE = '14/12/2012' | ||
HACKATHON_LOCATION = 'Barcelona' | ||
|
||
HACKATHON_CONTACT_EMAIL = '[email protected]' | ||
HACKATHON_SOCIALS = {'Facebook': ('https://www.facebook.com/hackupc', 'bi-facebook'), | ||
|
@@ -22,4 +25,8 @@ | |
SUPPORTED_RESUME_EXTENSIONS = ['.pdf'] | ||
FRIENDS_MAX_CAPACITY = None | ||
|
||
REQUIRE_PERMISSION_SLIP_TO_UNDER_AGE = True | ||
SUPPORTED_PERMISSION_SLIP_EXTENSIONS = ['.pdf'] | ||
PARTICIPANT_CAN_UPLOAD_PERMISSION_SLIP = True | ||
|
||
ATTRITION_RATE = 1.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
</tr> | ||
</tbody> | ||
</table> | ||
<p>If the link does not work: <a>{{ url }}</a></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 4.2.2 on 2023-09-11 12:05 | ||
|
||
import application.models | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('application', '0031_alter_applicationtypeconfig_spots'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PermissionSlip', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('status', models.CharField(choices=[('N', 'Missing document'), ('D', 'Not accepted'), ('U', 'On review'), ('A', 'Accepted')], default='N', max_length=2)), | ||
('file', models.FileField(null=True, upload_to=application.models.get_permission_slip_file_name)), | ||
('edition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='application.edition')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'permissions': (('can_review_permission_slip', 'Can review permission slip'),), | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
|
||
from django import forms | ||
from django.conf import settings | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from app.mixins import BootstrapFormMixin | ||
from application.models import PermissionSlip | ||
from application.validators import validate_file_extension | ||
|
||
EXTENSIONS = getattr(settings, 'SUPPORTED_PERMISSION_SLIP_EXTENSIONS', None) | ||
|
||
|
||
class PermissionSlipForm(forms.ModelForm, BootstrapFormMixin): | ||
bootstrap_field_info = {'': {'fields': [{'name': 'file', 'space': 12}, {'name': 'terms', 'space': 12}]}} | ||
|
||
file = forms.FileField(validators=[validate_file_extension(EXTENSIONS)], required=True, | ||
label=_('Upload your permission slip'), | ||
help_text=_('Accepted file formats: %s' % (', '.join(EXTENSIONS) if EXTENSIONS else 'Any'))) | ||
terms = forms.BooleanField(label=_('I understand that the permission slip I am providing will be used for ' | ||
'ensuring my safety during the event and for addressing any legal aspects ' | ||
'related to my participation in the hackathon. I hereby consent to the ' | ||
'use of this document for these purposes.'), required=True) | ||
|
||
def __init__(self, *args, **kwargs): | ||
instance = kwargs.get('instance', None) | ||
self._old_file = instance.file if instance is not None else None | ||
super().__init__(*args, **kwargs) | ||
|
||
def save(self, commit=True): | ||
instance = super().save(commit=False) | ||
instance.status = instance.STATUS_UPLOADED | ||
old_file = getattr(self, '_old_file', None) | ||
try: | ||
os.remove(old_file.path) | ||
except ValueError: | ||
pass | ||
if commit: | ||
instance.save() | ||
return instance | ||
|
||
class Meta: | ||
model = PermissionSlip | ||
fields = ('file', 'terms') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends 'mails/base.html' %} | ||
{% block content %} | ||
<p>Hi {{ user.first_name }},</p> | ||
|
||
|
||
{% if permission_slip.status == permission_slip.STATUS_ACCEPTED %} | ||
<p>Your permission slip has just been reviewed and has been accepted!</p> | ||
{% else %} | ||
<p>Your permission slip has some problem and has been denied. Check that everything on the permission slip is ok and sent it again. Remember it has to be signed by one of your parents or legal tutors</p> | ||
|
||
{% include 'mails/components/button.html' with url=url text='Check permission slip' %} | ||
{% endif %} | ||
|
||
<p>Best regards,</p> | ||
<p>{{ app_name }}.</p> | ||
{% endblock %} |
Oops, something went wrong.