week titles
This commit is contained in:
parent
92f21cc859
commit
bd6f03491c
5 changed files with 57 additions and 6 deletions
|
|
@ -34,7 +34,12 @@ def format_week(week):
|
|||
fmt = '%b %d'
|
||||
a = a.strftime(fmt)
|
||||
b = b.strftime(fmt)
|
||||
return '%s - %s' % (a, b)
|
||||
extra = models.Week.objects.filter(monday=week).first()
|
||||
if extra:
|
||||
extra = ': ' + extra.title
|
||||
else:
|
||||
extra = ''
|
||||
return '%s - %s%s' % (a, b, extra)
|
||||
|
||||
|
||||
def get_weeks(archive):
|
||||
|
|
@ -80,6 +85,9 @@ def archive(request, year=None, month=None, day=None, week=None):
|
|||
context['weeks'] = get_weeks(archive)
|
||||
context['this_week'] = date.strftime('%Y-%m-%d')
|
||||
context['this_year'] = date.strftime('%Y')
|
||||
extra = models.Week.objects.filter(monday=context['this_week']).first()
|
||||
if extra:
|
||||
context['week_title'] = extra.title
|
||||
elif week:
|
||||
week = int(week)
|
||||
year = int(year)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue