- Timestamp:
- Jan 15, 2019, 10:13:57 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 0c18869
- Parents:
- 9bee49d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/views/user.py
r9bee49d r2d91474 1 from calendar import month_name 2 1 3 from pyramid.httpexceptions import HTTPFound 2 4 from pyramid.view import view_config … … 112 114 Render a dashboard for the current user 113 115 """ 114 # Add here some logic 115 return {} 116 # Look at the year we are viewing, if none is passed in the request, 117 # pick up the latest/newer available with activity 118 viewing_year = request.GET.get('year', None) 119 if viewing_year is None: 120 available_years = context.activity_years 121 if available_years: 122 viewing_year = available_years[0] 123 else: 124 # ensure this is an integer 125 viewing_year = int(viewing_year) 126 127 # Same for the month, if there is a year set 128 viewing_month = None 129 if viewing_year: 130 viewing_month = request.GET.get('month', None) 131 if viewing_month is None: 132 available_months = context.activity_months(viewing_year) 133 if available_months: 134 # we pick up the latest month available for the year, 135 # which means the current month in the current year 136 viewing_month = available_months[-1] 137 else: 138 # ensure this is an integer 139 viewing_month = int(viewing_month) 140 141 # pick up the workouts to be shown in the dashboard 142 workouts = context.workouts(viewing_year, viewing_month) 143 144 return { 145 'month_name': month_name, 146 'viewing_year': viewing_year, 147 'viewing_month': viewing_month, 148 'workouts': workouts 149 } 116 150 117 151
Note: See TracChangeset
for help on using the changeset viewer.