Skip to content

Commit cf77530

Browse files
committed
Auto add date_collected in v2 advisory
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent b5a4445 commit cf77530

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

vulnerabilities/models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,9 +2961,15 @@ class AdvisoryV2(models.Model):
29612961
)
29622962

29632963
date_published = models.DateTimeField(
2964-
blank=True, null=True, help_text="UTC Date of publication of the advisory"
2964+
blank=True,
2965+
null=True,
2966+
help_text="UTC Date of publication of the advisory",
2967+
)
2968+
date_collected = models.DateTimeField(
2969+
auto_now_add=True,
2970+
db_index=True,
2971+
help_text="UTC Date on which the advisory was collected",
29652972
)
2966-
date_collected = models.DateTimeField(help_text="UTC Date on which the advisory was collected")
29672973

29682974
original_advisory_text = models.TextField(
29692975
blank=True,

vulnerabilities/pipes/advisory.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ def insert_advisory_v2(
313313
"avid": f"{pipeline_id}/{advisory.advisory_id}",
314314
"summary": advisory.summary,
315315
"date_published": advisory.date_published,
316-
"date_collected": datetime.now(timezone.utc),
317316
"original_advisory_text": advisory.original_advisory_text,
318317
"url": advisory.url,
319318
"precedence": precedence,

0 commit comments

Comments
 (0)