File tree Expand file tree Collapse file tree 4 files changed +35
-7
lines changed Expand file tree Collapse file tree 4 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 1+ # Generated by Django 5.1.14 on 2025-11-17 20:31
2+
3+ import dojo .models
4+ from django .db import migrations , models
5+
6+
7+ class Migration (migrations .Migration ):
8+
9+ dependencies = [
10+ ('dojo' , '0247_remove_finding_insert_insert_and_more' ),
11+ ]
12+
13+ operations = [
14+ migrations .AlterField (
15+ model_name = 'general_survey' ,
16+ name = 'expiration' ,
17+ field = models .DateTimeField (default = dojo .models .default_expiration ),
18+ ),
19+ ]
Original file line number Diff line number Diff line change @@ -3632,13 +3632,14 @@ def clean_expiration(self):
36323632 if expiration < today :
36333633 msg = "The expiration cannot be in the past"
36343634 raise forms .ValidationError (msg )
3635- if expiration . day == today . day :
3635+ if expiration == today :
36363636 msg = "The expiration cannot be today"
36373637 raise forms .ValidationError (msg )
3638- else :
3639- msg = "An expiration for the survey must be supplied"
3640- raise forms .ValidationError (msg )
3641- return expiration
3638+ return timezone .make_aware (
3639+ datetime .combine (expiration , datetime .min .time ()),
3640+ )
3641+ msg = "An expiration for the survey must be supplied"
3642+ raise forms .ValidationError (msg )
36423643
36433644
36443645class Delete_Questionnaire_Form (forms .ModelForm ):
Original file line number Diff line number Diff line change @@ -4692,11 +4692,15 @@ def __str__(self):
46924692 return self .survey .name
46934693
46944694
4695+ def default_expiration ():
4696+ return timezone .now () + timedelta (days = 7 )
4697+
4698+
46954699class General_Survey (models .Model ):
46964700 survey = models .ForeignKey (Engagement_Survey , on_delete = models .CASCADE )
46974701 num_responses = models .IntegerField (default = 0 )
46984702 generated = models .DateTimeField (auto_now_add = True , null = True )
4699- expiration = models .DateTimeField (null = False , blank = False )
4703+ expiration = models .DateTimeField (default = default_expiration )
47004704
47014705 class Meta :
47024706 verbose_name = _ ("General Engagement Survey" )
@@ -4705,6 +4709,10 @@ class Meta:
47054709 def __str__ (self ):
47064710 return self .survey .name
47074711
4712+ def clean (self ):
4713+ if self .expiration and timezone .is_naive (self .expiration ):
4714+ self .expiration = timezone .make_aware (self .expiration )
4715+
47084716
47094717with warnings .catch_warnings (action = "ignore" , category = ManagerInheritanceWarning ):
47104718 class Answer (PolymorphicModel , TimeStampedModel ):
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ django-ratelimit==4.1.0
6262argon2-cffi == 25.1.0
6363blackduck == 1.1.3
6464pycurl == 7.45.7 # Required for Celery Broker AWS (SQS) support
65- boto3 == 1.40.74 # Required for Celery Broker AWS (SQS) support
65+ boto3 == 1.40.75 # Required for Celery Broker AWS (SQS) support
6666netaddr == 1.3.0
6767vulners == 3.1.2
6868fontawesomefree == 6.6.0
You can’t perform that action at this time.
0 commit comments