Self hosted FLOSS fitness/workout, nutrition and weight tracker
Fix accessing the user data as a gym manager
Roland Geider1433e90577b4
diff --git a/wger/core/static/css/bootstrap-custom.css b/wger/core/static/css/bootstrap-custom.cssindex 5a701b841..b4376cfef 100644--- a/wger/core/static/css/bootstrap-custom.css+++ b/wger/core/static/css/bootstrap-custom.css@@ -181,22 +181,6 @@ body {* Alerts**************************************************************/-/*- * Links within boostrap's alert boxes are rendered in black- */-.alert a{- color: black;- text-decoration: underline;-}---.alert a:hover{- color: white;- text-decoration: underline;- text-shadow: none;-}--.label, .badge {font-weight: normal;}diff --git a/wger/core/templates/user/overview.html b/wger/core/templates/user/overview.htmlindex 35b849b87..793d10a92 100644--- a/wger/core/templates/user/overview.html+++ b/wger/core/templates/user/overview.html@@ -7,6 +7,8 @@{% block content %}+{% url 'core:trainer-login' current_user.pk as trainer_login %}+<h3>{% trans "Workouts" %} ({% trans "last 10" %})</h3><table class="table">@@ -20,7 +22,7 @@{% for workout in current_user.workout_set.all|slice:":10" %}<tr><td>- <a href="{% url 'workout-view' workout.pk %}">{{workout}}</a>+ <a href="{{trainer_login}}?next={% url 'workout-view' workout.pk %}">{{workout}}</a></td><td>{{workout.creation_date}}@@ -34,8 +36,9 @@</tbody></table>{% if perms.core.gym_trainer %}-<a href="{% url 'core:trainer-login' current_user.pk %}" class="btn btn-success btn-sm">{% trans "Log in as this user" %}</a>-<a href="{% url 'workout-add' current_user.pk %}" class="btn btn-default btn-sm">{% trans "Add workout" %}</a>++<a href="{{trainer_login}}" class="btn btn-success btn-sm">{% trans "Log in as this user" %}</a>+<a href="{{trainer_login}}?next={% url 'workout-add' %}" class="btn btn-default btn-sm">{% trans "Add workout" %}</a>{% endif %}diff --git a/wger/core/views/user.py b/wger/core/views/user.pyindex daef2eafe..c05ee8ea2 100644--- a/wger/core/views/user.py+++ b/wger/core/views/user.py@@ -119,7 +119,10 @@ def trainer_login(request, user_pk):if not own:request.session['trainer.identity'] = orig_user_pk- return HttpResponseRedirect(reverse('core:index'))+ if request.GET.get('next'):+ return HttpResponseRedirect(request.GET['next'])+ else:+ return HttpResponseRedirect(reverse('core:index'))else:return HttpResponseRedirect(reverse('core:gym-user-list',kwargs={'pk': user.userprofile.gym_id}))