Skip to content

Release 0.138.5#3324

Merged
odlbot merged 9 commits intoreleasefrom
release-candidate
Feb 25, 2026
Merged

Release 0.138.5#3324
odlbot merged 9 commits intoreleasefrom
release-candidate

Conversation

@odlbot
Copy link
Contributor

@odlbot odlbot commented Feb 23, 2026

annagav

renovate[bot]

Rachel Lougee

Tobias Macey

blarghmatey and others added 9 commits February 20, 2026 14:17
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@github-actions
Copy link

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:


## Changes for v1.yaml:


## Changes for v2.yaml:


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Comment on lines +1360 to +1363
def save(self, *args, **kwargs):
if not self.issue_date:
self.issue_date = getattr(self, "created_on", None)
super().save(*args, **kwargs)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The save() method on BaseCertificate incorrectly sets issue_date to None for new objects, which will cause a database IntegrityError because the field is non-nullable.
Severity: HIGH

Suggested Fix

Modify the save() method to avoid setting issue_date to None. Instead of reading from created_on (which is None on new instances pre-save), the logic should be removed to allow the field's default=timezone.now to function correctly. Alternatively, check if the object is new (e.g., self.pk is None) and handle the logic accordingly without assigning None.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: courses/models.py#L1360-L1363

Potential issue: When a new `BaseCertificate` instance is created without an
`issue_date` being explicitly set, the custom `save()` method is triggered. Inside this
method, the condition `if not self.issue_date:` evaluates to true. The code then
attempts to set `self.issue_date` from `self.created_on`. However, for a new object that
has not yet been saved to the database, `created_on` is `None`. This results in
`self.issue_date` being explicitly set to `None`, which overrides the field's
`default=timezone.now`. When `super().save()` is called, this `None` value violates the
`null=False` database constraint, causing an `IntegrityError` and preventing new
certificates from being created.

Did we get this right? 👍 / 👎 to inform future reviews.

@odlbot odlbot merged commit 9055894 into release Feb 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants