-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
50 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
from django.contrib import admin | ||
from .models import TrainedModel, TrainingStatus | ||
from django.db.models.signals import pre_delete | ||
from django.dispatch.dispatcher import receiver | ||
|
||
# Register your models here. | ||
admin.site.register(TrainedModel) | ||
admin.site.register(TrainingStatus) | ||
admin.site.register(TrainingStatus) | ||
|
||
|
||
@receiver(pre_delete, sender=TrainedModel) | ||
def onTrainedModelDelete(sender, instance, **kwargs): | ||
# Pass false so FileField doesn't save the model. | ||
instance.file.delete(False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters