I have created a Blog with the Django CMS "Wagtail". As a part of a blog page, I want to set a date in a specific format. Now, setting the date itself is not a problem at all. The blog page is constructed a bit like this:
class BlogPage(Page):
date = models.DateField("Post date")
intro = models.CharField(max_length=250)
body = RichTextField(blank=True)
tags = ClusterTaggableManager(through=BlogPageTag, blank=True)
author = models.ForeignKey(BlogAuthor, on_delete=models.PROTECT, null=True)
...
The DateField then creates a date on my blog page in the format "April 2, 2021". Alas, as we are located in Germany I'd like to change this format to "2. April 2021". I was searching a lot whether it would be feasible to add a parameter to the DateField in order to define the format. Didn't find anything that worked so far.
Any ideas? Thanks in advance! Timo
After a lack of response to my (apparently very individual) problem I decided to brute force it.
I wrote a JS function that takes a hold of the date field upon page load and translates its content to the format that I'd like to have.
This is not a very fancy solution, but it works very well. I thought it might help anyone with a common problem looking for a way out.