parent
f3d152b454
commit
baea657d1a
5 changed files with 79 additions and 11 deletions
|
|
@ -11,14 +11,7 @@ class Command(BaseCommand):
|
|||
parser.add_argument("amount", type=int)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
unabmigous_characters = "abcdefghijkmnopqrstuvwxyzACDEFHJKLMNPQRTUVWXY1234679"
|
||||
|
||||
vouchers = set()
|
||||
while len(vouchers) < options["amount"]:
|
||||
random_part = "".join(choices(unabmigous_characters, k=5))
|
||||
vouchers.add(f"{options['prefix']}-{random_part}")
|
||||
|
||||
Voucher.objects.bulk_create(Voucher(code=v) for v in vouchers)
|
||||
vouchers = Voucher.bulk_generate(options["prefix"], options["amount"])
|
||||
|
||||
header = r"""\begin{document}
|
||||
\begin{center}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue