Add initial database erase support

This commit is contained in:
Roberto Rosario
2012-07-26 05:03:02 -04:00
parent bccc228fa0
commit ac65a6db76
7 changed files with 74 additions and 16 deletions

View File

@@ -2,14 +2,48 @@ from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.contrib.auth.models import User, Group
from metadata.models import MetadataType, MetadataSet
from document_indexing.models import Index, IndexTemplateNode
from documents.models import DocumentType, DocumentTypeFilename
from documents.models import DocumentType, DocumentTypeFilename, Document
from permissions.models import Role
from metadata.api import save_metadata_list
#from sources.models import WebForm, StagingFolder
bootstrap_options = {}
def nuke_database():
for obj in Document.objects.all():
obj.delete()
for obj in MetadataType.objects.all():
obj.delete()
for obj in MetadataSet.objects.all():
obj.delete()
for obj in Index.objects.all():
obj.delete()
for obj in DocumentType.objects.all():
obj.delete()
#for obj in WebForm.objects.all():
# obj.delete()
#for obj in StagingFolder.objects.all():
# obj.delete()
for obj in Group.objects.all():
obj.delete()
for obj in User.objects.all():
if not obj.is_superuser and not obj.is_staff:
obj.delete()
class BootstrapBase(object):
name = None
label = ''