mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Allow to add a prefix when generating voucher codes (#518)
This commit is contained in:
committed by
Raphael Michel
parent
8e3cc0df0c
commit
8fa490c938
@@ -13,8 +13,10 @@ from .event import Event
|
||||
from .items import Item, ItemVariation, Quota
|
||||
|
||||
|
||||
def _generate_random_code():
|
||||
def _generate_random_code(prefix=None):
|
||||
charset = list('ABCDEFGHKLMNPQRSTUVWXYZ23456789')
|
||||
if prefix:
|
||||
return prefix + get_random_string(length=settings.ENTROPY['voucher_code'], allowed_chars=charset)
|
||||
return get_random_string(length=settings.ENTROPY['voucher_code'], allowed_chars=charset)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user