feat: A la signature d'un document, on récupère l'URL du PDF [#22]

This commit is contained in:
N3WT DE COMPET
2025-03-01 23:55:48 +01:00
parent eb81bbba92
commit 2ac4832985
8 changed files with 97 additions and 16 deletions

View File

@ -219,12 +219,16 @@ class RegistrationForm(models.Model):
def __str__(self):
return "RF_" + self.student.last_name + "_" + self.student.first_name
def registration_file_upload_to(instance, filename):
return f"registration_files/dossier_rf_{instance.register_form.pk}/{filename}"
class RegistrationTemplate(models.Model):
master = models.ForeignKey(RegistrationTemplateMaster, on_delete=models.CASCADE, related_name='templates')
template_id = models.IntegerField(primary_key=True)
slug = models.CharField(max_length=255, default="")
name = models.CharField(max_length=255, default="")
registration_form = models.ForeignKey(RegistrationForm, on_delete=models.CASCADE, related_name='templates')
file = models.FileField(null=True,blank=True, upload_to=registration_file_upload_to)
def __str__(self):
return self.name
@ -234,7 +238,7 @@ class RegistrationTemplate(models.Model):
"""
Récupère tous les fichiers liés à un dossier dinscription donné.
"""
registration_files = RegistrationTemplate.objects.filter(register_form_id=register_form_id).order_by('template__order')
registration_files = RegistrationTemplate.objects.filter(registration_form=register_form_id)
filenames = []
for reg_file in registration_files:
filenames.append(reg_file.file.path)