I have fetched a date from database with the following variable
{{ i.operation_date }}
Here's one more answer that I've found to be pretty concise and doesn't use external packages:
import datetime as dt
# Assuming `day` has type dt.date
one_year_delta = dt.timedelta(days=366 if ((day.month >= 3 and calendar.isleap(day.year+1)) or
(day.month < 3 and calendar.isleap(day.year))) else 365)
day += one_year_delta