@register.filter
def week_number(date):
 week_number = date.strftime('%W')
 if (int(week_number) < 10):
  week_number = week_number[(-1)]
 return week_number

@ register . filter def week_number ( date ) : week_number = date . strftime ( '%W' ) if ( int ( week_number ) < 10 ) : week_number = week_number [ ( - 1 ) ] return week_number
return the python week number of a date .