Compare commits
No commits in common. "main" and "0.11" have entirely different histories.
3 changed files with 2 additions and 41 deletions
|
|
@ -117,7 +117,7 @@ TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBacken
|
|||
|
||||
STATIC_ROOT = BASE_DIR.parent.parent / "static"
|
||||
|
||||
RELEASE_VERSION = "0.12"
|
||||
RELEASE_VERSION = "0.11"
|
||||
|
||||
# Import settings from configuration.py
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from random import choices
|
||||
from ...models import Voucher
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "bulk-add vouchers with a given prefix and generate a latex output to render them"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("prefix", type=str)
|
||||
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)
|
||||
|
||||
header = r"""\begin{document}
|
||||
\begin{center}
|
||||
"""
|
||||
output = header
|
||||
even = False
|
||||
for v in vouchers:
|
||||
output += f"\\voucher{{{v}}}"
|
||||
if even:
|
||||
output += "\\newline\n"
|
||||
else:
|
||||
output += "\n"
|
||||
even = not even
|
||||
|
||||
output += r"""\end{center}
|
||||
\end{document}"""
|
||||
|
||||
print(output)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "community_backup"
|
||||
version = "0.12"
|
||||
version = "0.11"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue