forked from 0x2620/pandora
delete pdfs before deleting text object
This commit is contained in:
parent
051e1aff7e
commit
d693fe66cc
1 changed files with 7 additions and 0 deletions
|
@ -9,6 +9,7 @@ from glob import glob
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
from django.db.models.signals import pre_delete
|
||||
import ox
|
||||
from ox.django.fields import DictField, TupleField
|
||||
|
||||
|
@ -168,6 +169,12 @@ class Text(models.Model):
|
|||
return True
|
||||
return False
|
||||
|
||||
def delete_file(sender, **kwargs):
|
||||
t = kwargs['instance']
|
||||
if t.file:
|
||||
t.file.delete()
|
||||
pre_delete.connect(delete_file, sender=Text)
|
||||
|
||||
class Position(models.Model):
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in a new issue