Changeset 02048a6 in OpenWorkouts-current for ow/views/user.py
- Timestamp:
- Jan 16, 2019, 11:52:22 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 816820d, c6219ed
- Parents:
- 7388b68 (diff), ad5759b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/views/user.py
r7388b68 r02048a6 1 from calendar import month_name 2 1 3 from pyramid.httpexceptions import HTTPFound 2 4 from pyramid.view import view_config … … 99 101 name='forgot-password', 100 102 renderer='ow:templates/forgot_password.pt') 101 def recover_password(context, request): 103 def recover_password(context, request): # pragma: no cover 102 104 # WIP 103 105 Form(request) … … 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.