Add str method to attachment
This commit is contained in:
parent
57c1fe1ce8
commit
945768a3e6
1 changed files with 3 additions and 0 deletions
|
@ -14,6 +14,9 @@ class Attachment(models.Model):
|
||||||
original_file = models.FileField()
|
original_file = models.FileField()
|
||||||
processed_file = models.FileField(blank=True, null=True)
|
processed_file = models.FileField(blank=True, null=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.description} ({self.original_file.name})"
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.processed_file:
|
if self.processed_file:
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
Reference in a new issue