On déplace choices_length
dans shared
This commit is contained in:
parent
eb075fd771
commit
2fc4073351
3 changed files with 13 additions and 14 deletions
|
@ -5,6 +5,8 @@ from django.contrib.auth.models import AbstractUser
|
|||
from django.db import models, transaction
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from shared.utils import choices_length
|
||||
|
||||
from .staticdefs import (
|
||||
BALLOT_TYPE,
|
||||
CAST_FUNCTIONS,
|
||||
|
@ -19,7 +21,6 @@ from .utils import (
|
|||
ResultsData,
|
||||
TallyFunctions,
|
||||
ValidateFunctions,
|
||||
choices_length,
|
||||
)
|
||||
|
||||
# #############################################################################
|
||||
|
|
|
@ -16,19 +16,6 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
from shared.auth.utils import generate_password
|
||||
|
||||
# #############################################################################
|
||||
# Fonctions universelles
|
||||
# #############################################################################
|
||||
|
||||
|
||||
def choices_length(choices):
|
||||
"""Renvoie la longueur maximale des choix de choices"""
|
||||
m = 0
|
||||
for c in choices:
|
||||
m = max(m, len(c[0]))
|
||||
return m
|
||||
|
||||
|
||||
# #############################################################################
|
||||
# Classes pour différencier les différents types de questions
|
||||
# #############################################################################
|
||||
|
|
11
shared/utils.py
Normal file
11
shared/utils.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
# #############################################################################
|
||||
# Fonctions universelles
|
||||
# #############################################################################
|
||||
|
||||
|
||||
def choices_length(choices):
|
||||
"""Renvoie la longueur maximale des choix de choices"""
|
||||
m = 0
|
||||
for c in choices:
|
||||
m = max(m, len(c[0]))
|
||||
return m
|
Loading…
Reference in a new issue