1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-04 13:32:14 +02:00

Upload photo authorizations

This commit is contained in:
Yohann D'ANELLO
2020-09-24 22:40:10 +02:00
parent e1ca18085a
commit 468295f648
11 changed files with 148 additions and 36 deletions

View File

@ -2,6 +2,7 @@ from corres2math.tokens import email_validation_token
from django.contrib.sites.models import Site
from django.db import models
from django.template import loader
from django.utils.crypto import get_random_string
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.utils.translation import gettext_lazy as _
@ -66,6 +67,10 @@ class Registration(PolymorphicModel):
verbose_name_plural = _("registrations")
def get_random_filename(instance, filename):
return get_random_string(64)
class StudentRegistration(Registration):
team = models.ForeignKey(
"participation.Team",
@ -90,6 +95,14 @@ class StudentRegistration(Registration):
verbose_name=_("school"),
)
# FIXME Fix permission access, mime type
photo_authorization = models.FileField(
verbose_name=_("photo authorization"),
upload_to=get_random_filename,
blank=True,
default="",
)
@property
def type(self):
return _("student")