Skip to content

Instantly share code, notes, and snippets.

View herrbenesch's full-sized avatar

Jörg Benesch herrbenesch

  • Berlin
  • 20:02 (UTC +02:00)
View GitHub Profile
@herrbenesch
herrbenesch / datetime_custom_filters.py
Last active April 19, 2022 08:15
A custom German django template datetime filter
from django.conf.locale import LANG_INFO
from django.utils import translation
from django import template
register = template.Library()
@register.filter(expects_localtime=True, is_safe=False)
def german_datetime(value):
"""Convert a datetime object to the German date format.

Keybase proof

I hereby claim:

  • I am fidelitas on github.
  • I am fidelitas (https://keybase.io/fidelitas) on keybase.
  • I have a public key ASDu9HOTWesjE004tjSl_6luwzZRTXC9gts-mKZkX5rJoQo

To claim this, I am signing this object: