* adds EditEcoAccountForm
* adds placeholders for some form fields
* changes comment card in detail view into rlp-grayish
* adds eco account detail view comment box
* removes unnecessary loading of dal scripts in view.html
* refactors generated identifier for data objects (10 digits to 6 uppercase letter-digit combination)
* improves generate_random_string() method by adding more options for generation of strings
* adds/updates translations
This commit is contained in:
mipel
2021-10-06 13:10:10 +02:00
parent d84fe68120
commit 60f03591ef
20 changed files with 305 additions and 166 deletions

View File

@@ -9,14 +9,18 @@ import random
import string
def generate_random_string(length: int, only_numbers: bool = False) -> str:
def generate_random_string(length: int, use_numbers: bool = False, use_letters_lc: bool = False, use_letters_uc: bool = False) -> str:
"""
Generates a random string of variable length
"""
if only_numbers:
elements = string.digits
else:
elements = string.ascii_letters
elements = []
if use_numbers:
elements.append(string.digits)
if use_letters_lc:
elements.append(string.ascii_lowercase)
if use_letters_uc:
elements.append(string.ascii_uppercase)
elements = "".join(elements)
ret_val = "".join(random.choice(elements) for i in range(length))
return ret_val