Create the Asset Database (#363)

This commit is contained in:
2019-12-04 23:14:27 +00:00
committed by David Taylor
parent 5210afc772
commit 4f036af85a
97 changed files with 2577 additions and 344 deletions

View File

@@ -0,0 +1,23 @@
from django.core.management.base import BaseCommand, CommandError
from assets import models
class Command(BaseCommand):
help = 'Deletes testing sample data'
def handle(self, *args, **kwargs):
from django.conf import settings
if not (settings.DEBUG):
raise CommandError('You cannot run this command in production')
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()