mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-01 23:21:18 +02:00
Add parental and photo authorizations + make health and vaccine sheet and motivation letter optional
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -442,7 +442,10 @@ class AuthorizationTemplateView(TemplateView):
|
||||
return context
|
||||
|
||||
def render_to_response(self, context, **response_kwargs):
|
||||
tex = render_to_string(self.template_name, context=context, request=self.request)
|
||||
translation.activate(settings.PREFERRED_LANGUAGE_CODE)
|
||||
|
||||
template_name = self.get_template_names()[0]
|
||||
tex = render_to_string(template_name, context=context, request=self.request)
|
||||
temp_dir = mkdtemp()
|
||||
with open(os.path.join(temp_dir, "texput.tex"), "w") as f:
|
||||
f.write(tex)
|
||||
@ -451,20 +454,34 @@ class AuthorizationTemplateView(TemplateView):
|
||||
process.wait()
|
||||
return FileResponse(open(os.path.join(temp_dir, "texput.pdf"), "rb"),
|
||||
content_type="application/pdf",
|
||||
filename=self.template_name.split("/")[-1][:-3] + "pdf")
|
||||
filename=template_name.split("/")[-1][:-3] + "pdf")
|
||||
|
||||
|
||||
class AdultPhotoAuthorizationTemplateView(AuthorizationTemplateView):
|
||||
template_name = "registration/tex/Autorisation_droit_image_majeur.tex"
|
||||
def get_template_names(self):
|
||||
if settings.TFJM_APP == "TFJM":
|
||||
return ["registration/tex/Autorisation_droit_image_majeur.tex"]
|
||||
elif settings.TFJM_APP == "ETEAM":
|
||||
return ["registration/tex/photo_authorization_eteam_adult.tex"]
|
||||
|
||||
|
||||
class ChildPhotoAuthorizationTemplateView(AuthorizationTemplateView):
|
||||
template_name = "registration/tex/Autorisation_droit_image_mineur.tex"
|
||||
def get_template_names(self):
|
||||
if settings.TFJM_APP == "TFJM":
|
||||
return ["registration/tex/Autorisation_droit_image_mineur.tex"]
|
||||
elif settings.TFJM_APP == "ETEAM":
|
||||
return ["registration/tex/photo_authorization_eteam_child.tex"]
|
||||
|
||||
|
||||
class ParentalAuthorizationTemplateView(AuthorizationTemplateView):
|
||||
template_name = "registration/tex/Autorisation_parentale.tex"
|
||||
|
||||
def get_template_names(self):
|
||||
if settings.TFJM_APP == "TFJM":
|
||||
return ["registration/tex/Autorisation_parentale.tex"]
|
||||
elif settings.TFJM_APP == "ETEAM":
|
||||
return ["registration/tex/parental_authorization_eteam.tex"]
|
||||
|
||||
|
||||
class InstructionsTemplateView(AuthorizationTemplateView):
|
||||
template_name = "registration/tex/Instructions.tex"
|
||||
|
Reference in New Issue
Block a user