Merge branch 'dev' into 'master'
Dev See merge request animath/si/plateforme-tfjm!11
This commit is contained in:
commit
f83b4c094e
|
@ -61,7 +61,7 @@ class ParticipationForm(forms.ModelForm):
|
||||||
|
|
||||||
class MotivationLetterForm(forms.ModelForm):
|
class MotivationLetterForm(forms.ModelForm):
|
||||||
def clean_file(self):
|
def clean_file(self):
|
||||||
if "file" in self.files:
|
if "motivation_letter" in self.files:
|
||||||
file = self.files["motivation_letter"]
|
file = self.files["motivation_letter"]
|
||||||
if file.size > 2e6:
|
if file.size > 2e6:
|
||||||
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
|
raise ValidationError(_("The uploaded file size must be under 2 Mo."))
|
||||||
|
|
|
@ -23,7 +23,10 @@ class Command(BaseCommand):
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
if not os.path.isfile(".matrix_avatar"):
|
if not os.path.isfile(".matrix_avatar"):
|
||||||
avatar_uri = Matrix.get_avatar()
|
avatar_uri = Matrix.get_avatar()
|
||||||
if not isinstance(avatar_uri, str):
|
if isinstance(avatar_uri, str):
|
||||||
|
with open(".matrix_avatar", "w") as f:
|
||||||
|
f.write(avatar_uri)
|
||||||
|
else:
|
||||||
stat_file = os.stat("tfjm/static/logo.png")
|
stat_file = os.stat("tfjm/static/logo.png")
|
||||||
with open("tfjm/static/logo.png", "rb") as f:
|
with open("tfjm/static/logo.png", "rb") as f:
|
||||||
resp = Matrix.upload(f, filename="logo.png", content_type="image/png",
|
resp = Matrix.upload(f, filename="logo.png", content_type="image/png",
|
||||||
|
|
|
@ -391,7 +391,7 @@ class TeamAuthorizationsView(LoginRequiredMixin, DetailView):
|
||||||
_("Parental authorization of {participant}.{ext}")
|
_("Parental authorization of {participant}.{ext}")
|
||||||
.format(participant=str(participant), ext=ext))
|
.format(participant=str(participant), ext=ext))
|
||||||
|
|
||||||
if participant.health_sheet:
|
if isinstance(participant, StudentRegistration) and participant.health_sheet:
|
||||||
mime_type = magic.from_file("media/" + participant.health_sheet.name)
|
mime_type = magic.from_file("media/" + participant.health_sheet.name)
|
||||||
ext = mime_type.split("/")[1].replace("jpeg", "jpg")
|
ext = mime_type.split("/")[1].replace("jpeg", "jpg")
|
||||||
zf.write("media/" + participant.health_sheet.name,
|
zf.write("media/" + participant.health_sheet.name,
|
||||||
|
|
|
@ -159,7 +159,13 @@ class ParticipantRegistration(Registration):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def under_18(self):
|
def under_18(self):
|
||||||
return (timezone.now().date() - self.birth_date).days < 18 * 365.24
|
important_date = timezone.now().date()
|
||||||
|
if self.team and self.team.participation.tournament:
|
||||||
|
important_date = self.team.participation.tournament.date_start
|
||||||
|
if self.team.participation.final:
|
||||||
|
from participation.models import Tournament
|
||||||
|
important_date = Tournament.final_tournament().date_start
|
||||||
|
return (important_date - self.birth_date).days < 18 * 365.24
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self): # pragma: no cover
|
def type(self): # pragma: no cover
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Matrix:
|
||||||
"""
|
"""
|
||||||
client = await cls._get_client()
|
client = await cls._get_client()
|
||||||
resp = await client.get_avatar()
|
resp = await client.get_avatar()
|
||||||
return resp.avatar_url if resp.status_code == 200 else resp
|
return resp.avatar_url if hasattr(resp, "avatar_url") else resp
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@async_to_sync
|
@async_to_sync
|
||||||
|
|
|
@ -56,6 +56,7 @@ INSTALLED_APPS = [
|
||||||
'address',
|
'address',
|
||||||
'bootstrap_datepicker_plus',
|
'bootstrap_datepicker_plus',
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
|
'django_filters',
|
||||||
'django_tables2',
|
'django_tables2',
|
||||||
'haystack',
|
'haystack',
|
||||||
'logs',
|
'logs',
|
||||||
|
|
Loading…
Reference in New Issue