1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-08-14 10:06:40 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Yohann D'ANELLO
b5136ffa91 A motivation letter must be a PDF/JPEG/PNG file (it didn't work) 2021-01-23 14:26:15 +01:00
Yohann D'ANELLO
d9a2b31606 Django filters was missing 2021-01-23 13:43:31 +01:00
Yohann D'ANELLO
01a6e28623 Fix matrix avatar 2021-01-23 13:41:43 +01:00
4 changed files with 7 additions and 3 deletions

View File

@@ -61,7 +61,7 @@ class ParticipationForm(forms.ModelForm):
class MotivationLetterForm(forms.ModelForm):
def clean_file(self):
if "file" in self.files:
if "motivation_letter" in self.files:
file = self.files["motivation_letter"]
if file.size > 2e6:
raise ValidationError(_("The uploaded file size must be under 2 Mo."))

View File

@@ -23,7 +23,10 @@ class Command(BaseCommand):
else: # pragma: no cover
if not os.path.isfile(".matrix_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")
with open("tfjm/static/logo.png", "rb") as f:
resp = Matrix.upload(f, filename="logo.png", content_type="image/png",

View File

@@ -76,7 +76,7 @@ class Matrix:
"""
client = await cls._get_client()
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
@async_to_sync

View File

@@ -56,6 +56,7 @@ INSTALLED_APPS = [
'address',
'bootstrap_datepicker_plus',
'crispy_forms',
'django_filters',
'django_tables2',
'haystack',
'logs',