Skip to content

Commit

Permalink
Change curriculo model to work with cloudinary
Browse files Browse the repository at this point in the history
  • Loading branch information
FredMagas committed Aug 9, 2024
1 parent 05cb97f commit 2fcd75a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fredmagaweb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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"

0 comments on commit 2fcd75a

Please sign in to comment.