Skip to content

Commit 8b4276a

Browse files
authored
Merge branch 'dev' into add-openreports-import
2 parents 27a3665 + 820f74c commit 8b4276a

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
]

dojo/forms.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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

36443645
class Delete_Questionnaire_Form(forms.ModelForm):

dojo/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
46954699
class 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

47094717
with warnings.catch_warnings(action="ignore", category=ManagerInheritanceWarning):
47104718
class Answer(PolymorphicModel, TimeStampedModel):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ django-ratelimit==4.1.0
6262
argon2-cffi==25.1.0
6363
blackduck==1.1.3
6464
pycurl==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
6666
netaddr==1.3.0
6767
vulners==3.1.2
6868
fontawesomefree==6.6.0

0 commit comments

Comments
 (0)