Revert "Minor python cleanup"

This reverts commit 6a4620a2e5.
This commit is contained in:
2021-01-28 18:54:50 +00:00
parent 4b8639faf4
commit a3970cf553
5 changed files with 67 additions and 77 deletions

View File

@@ -3,11 +3,6 @@ from django.core.management.base import BaseCommand, CommandError
from assets import models
def delete_objects(model):
for object in model.objects.all():
object.delete()
class Command(BaseCommand):
help = 'Deletes testing sample data'
@@ -17,8 +12,12 @@ class Command(BaseCommand):
if not (settings.DEBUG):
raise CommandError('You cannot run this command in production')
delete_objects(models.AssetCategory)
delete_objects(models.AssetStatus)
delete_objects(models.Supplier)
delete_objects(models.Connector)
delete_objects(models.Asset)
self.delete_objects(models.AssetCategory)
self.delete_objects(models.AssetStatus)
self.delete_objects(models.Supplier)
self.delete_objects(models.Connector)
self.delete_objects(models.Asset)
def delete_objects(self, model):
for object in model.objects.all():
object.delete()