-
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.
temp: add management command to delete all test records (#25)
* temp: add management command to delete all test records
- Loading branch information
1 parent
39f03a0
commit e5ae9f1
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
sanctions/apps/sanctions/management/commands/delete_all_metadata_records.py
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Django management command to delete all metadata records. | ||
""" | ||
import logging | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from sanctions.apps.sanctions.models import SanctionsCheckFailure | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Command to delete all SanctionsCheckFailure records. | ||
""" | ||
help = 'Delete all SanctionsCheckFailure records.' | ||
|
||
def handle(self, *args, **options): | ||
logger.info('Beginning deletion of SanctionsCheckFailure records.') | ||
all_records = SanctionsCheckFailure.objects.all().iterator() | ||
|
||
for record in all_records: | ||
logger.info('Deleting record %s', record.id) | ||
record.delete() | ||
logger.info('Deleted record %s', record.id) | ||
|
||
logger.info('Completed deletion of SanctionsCheckFailure records.') |