[Django]-Generating a date relative to another date in Django template

0👍

This cannot be done in Django templates as of this writing without writing a custom template tag in Python.

12👍

You can create your own template tag:

import datetime

from django import template

register = template.Library()

@register.filter
def plus_days(value, days):
    return value + datetime.timedelta(days=days)

Leave a comment