Page MenuHomec4science

oacct-purge.py
No OneTemporary

File Metadata

Created
Wed, Nov 6, 07:14

oacct-purge.py

from django.core.management import BaseCommand
from django_api.models import Issn
from django_api.models import Oa
from django_api.models import Publisher
from django_api.models import Journal
from django_api.models import Organization
from django_api.models import Version
from django_api.models import Licence
from django_api.models import Cost_factor_type
from django_api.models import Cost_factor
from django_api.models import Term
from django_api.models import ConditionType
from django_api.models import ConditionSet
from django_api.models import OrganizationCondition
from django_api.models import JournalCondition
class Command(BaseCommand):
help = (
'Automatically generates a filter class for a model '
'with all relations to the specified depth.'
)
def handle(self, *args, **options):
Issn.objects.all().delete()
print('Issns purged')
Publisher.objects.all().delete()
print('Publishers purged')
OrganizationCondition.objects.all().delete()
print('OrganizationConditions purged')
JournalCondition.objects.all().delete()
print('OrganizationConditions purged')
Journal.objects.all().delete()
print('Journals purged')
Organization.objects.all().delete()
print('Organizations purged')
Licence.objects.all().delete()
print('Licences purged')
Cost_factor.objects.all().delete()
print('Cost_factors purged')
Term.objects.all().delete()
print('Terms purged')
ConditionSet.objects.all().delete()
print('ConditionSets purged')
print('Purge complete')

Event Timeline