Skip to content

Commit

Permalink
Merge pull request #4001 from open-formulieren/issue/3705-submission-str
Browse files Browse the repository at this point in the history
[#3705] Fix submission `__str__` again
  • Loading branch information
Viicos authored Mar 13, 2024
2 parents bed8118 + fa5212b commit b729643
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/openforms/submissions/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.db import models, transaction
from django.utils.formats import localize
from django.utils.functional import cached_property
from django.utils.timezone import localtime
from django.utils.translation import get_language, gettext_lazy as _

import elasticapm
Expand Down Expand Up @@ -331,7 +332,7 @@ class Meta:
def __str__(self):
return _("{pk} - started on {started}").format(
pk=self.pk or _("(unsaved)"),
started=localize(self.created_on) or _("(no timestamp yet)"),
started=localize(localtime(self.created_on)) or _("(no timestamp yet)"),
)

def refresh_from_db(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/submissions/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SubmissionTests(TestCase):
def test_submission_str(self):
submission = SubmissionFactory.create()
self.assertEqual(
str(submission), f"{submission.pk} - started on Nov. 26, 2021, 4 p.m."
str(submission), f"{submission.pk} - started on Nov. 26, 2021, 5 p.m."
)

def test_submission_data_with_selectboxes_formio_formatters(self):
Expand Down

0 comments on commit b729643

Please sign in to comment.