diff --git a/elections/models.py b/elections/models.py index 85a69eb..c7c61c8 100644 --- a/elections/models.py +++ b/elections/models.py @@ -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, ) # ############################################################################# diff --git a/elections/utils.py b/elections/utils.py index c597f2d..ce8876c 100644 --- a/elections/utils.py +++ b/elections/utils.py @@ -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 # ############################################################################# diff --git a/shared/utils.py b/shared/utils.py new file mode 100644 index 0000000..cda8450 --- /dev/null +++ b/shared/utils.py @@ -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