From 2fcd75a5f86106eb869a407993063ff8937951d1 Mon Sep 17 00:00:00 2001 From: FredMagas Date: Fri, 9 Aug 2024 00:25:14 -0300 Subject: [PATCH] Change curriculo model to work with cloudinary --- fredmagaweb/models.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fredmagaweb/models.py b/fredmagaweb/models.py index 68240ae..fd5d475 100644 --- a/fredmagaweb/models.py +++ b/fredmagaweb/models.py @@ -22,12 +22,17 @@ def __str__(self): return self.title class Curriculo(models.Model): - arquivo = models.FileField(upload_to='curriculos/', storage=settings.PDF_STORAGE) + arquivo = models.FileField(upload_to='curriculos/') data_upload = models.DateTimeField(auto_now_add=True) def __str__(self): return f"Curriculo {self.id} - {self.data_upload.strftime('%d/%m/%Y')}" - class Meta: - verbose_name = "Currículo" - verbose_name_plural = "Currículos" \ No newline at end of file + def save(self, *args, **kwargs): + # Garantir que o arquivo PDF seja tratado como 'raw' + self.arquivo.upload_options = {'resource_type': 'raw'} + super().save(*args, **kwargs) + + # class Meta: + # verbose_name = "Currículo" + # verbose_name_plural = "Currículos" \ No newline at end of file