Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def handle(self, *args, **options):
records = []
Record.objects.all().delete()
for i in range(1000000):
if i % 2 == 0:
active = True
else:
active = False
records.append(Record(active=active, name='record %d' % i,
description='description %d' % i))
Record.objects.bulk_create(records)
RecordPage.objects.all().delete()
records = Record.objects.filter(active=True).order_by('name')
paginator = Paginator(records, 48)
records_pages = []