@@ -194,10 +194,6 @@ class Visibility(models.IntegerChoices):
194
194
195
195
objects = QuestionnaireManager ()
196
196
197
- def clean (self ):
198
- if self .type == self .Type .CONTRIBUTOR and self .is_locked :
199
- raise ValidationError ({"is_locked" : _ ("Contributor questionnaires cannot be locked." )})
200
-
201
197
class Meta :
202
198
ordering = ["type" , "order" , "pk" ]
203
199
verbose_name = _ ("questionnaire" )
@@ -206,6 +202,10 @@ class Meta:
206
202
def __str__ (self ):
207
203
return self .name
208
204
205
+ def clean (self ):
206
+ if self .type == self .Type .CONTRIBUTOR and self .is_locked :
207
+ raise ValidationError ({"is_locked" : _ ("Contributor questionnaires cannot be locked." )})
208
+
209
209
def __lt__ (self , other ):
210
210
return (self .type , self .order , self .pk ) < (other .type , other .order , other .pk )
211
211
@@ -1245,6 +1245,9 @@ class Choices(NamedTuple):
1245
1245
names : list [StrOrPromise ]
1246
1246
is_inverted : bool
1247
1247
1248
+ def zipped (self ):
1249
+ return zip (self .names , self .colors , self .values , strict = True )
1250
+
1248
1251
1249
1252
class BipolarChoices (NamedTuple ):
1250
1253
css_class : str
@@ -1256,6 +1259,9 @@ class BipolarChoices(NamedTuple):
1256
1259
minus_name : StrOrPromise
1257
1260
is_inverted : bool
1258
1261
1262
+ def zipped (self ):
1263
+ return zip (self .names , self .colors , self .values , strict = True )
1264
+
1259
1265
1260
1266
NO_ANSWER = 6
1261
1267
BASE_UNIPOLAR_CHOICES = {
@@ -1470,7 +1476,7 @@ class TextAnswer(Answer):
1470
1476
1471
1477
answer = models .TextField (verbose_name = _ ("answer" ))
1472
1478
# If the text answer was changed during review, original_answer holds the original text. Otherwise, it's null.
1473
- original_answer = models .TextField (verbose_name = _ ("original answer" ), blank = True , null = True )
1479
+ original_answer = models .TextField (verbose_name = _ ("original answer" ), blank = True , null = True ) # noqa: DJ001
1474
1480
1475
1481
class ReviewDecision (models .TextChoices ):
1476
1482
"""
@@ -1613,9 +1619,6 @@ class Infotext(models.Model):
1613
1619
content_en = models .TextField (verbose_name = _ ("content (english)" ), blank = True )
1614
1620
content = translate (en = "content_en" , de = "content_de" )
1615
1621
1616
- def is_empty (self ):
1617
- return not (self .title or self .content )
1618
-
1619
1622
class Page (models .TextChoices ):
1620
1623
STUDENT_INDEX = ("student_index" , "Student index page" )
1621
1624
CONTRIBUTOR_INDEX = ("contributor_index" , "Contributor index page" )
@@ -1640,6 +1643,9 @@ class Meta:
1640
1643
),
1641
1644
)
1642
1645
1646
+ def is_empty (self ):
1647
+ return not (self .title or self .content )
1648
+
1643
1649
1644
1650
class UserProfileManager (BaseUserManager ):
1645
1651
def create_user (self , * , email , password = None , first_name = None , last_name = None ):
0 commit comments