Skip to content
Snippets Groups Projects
Verified Commit 9528d512 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Fix check if group is selected.

parent eecf9b19
No related branches found
No related tags found
1 merge request!22Resolve "[Week view] print button is missing"
...@@ -97,6 +97,10 @@ def week_view(request: HttpRequest, year: Optional[int] = None, week: Optional[i ...@@ -97,6 +97,10 @@ def week_view(request: HttpRequest, year: Optional[int] = None, week: Optional[i
group = None # FIXME workaround for #38 group = None # FIXME workaround for #38
if request.GET.get('group', None) or request.GET.get('teacher', None) or request.GET.get('room', None): if request.GET.get('group', None) or request.GET.get('teacher', None) or request.GET.get('room', None):
lesson_periods = lesson_periods.filter_from_query(request.GET) lesson_periods = lesson_periods.filter_from_query(request.GET)
if 'group' in request.GET and request.GET['group']:
group = Group.objects.get(pk=request.GET['group'])
else:
group = None
elif hasattr(request, 'user') and hasattr(request.user, 'person'): elif hasattr(request, 'user') and hasattr(request.user, 'person'):
group = request.user.person.owner_of.first() group = request.user.person.owner_of.first()
lesson_periods = lesson_periods.filter_group(group) lesson_periods = lesson_periods.filter_group(group)
...@@ -138,6 +142,7 @@ def week_view(request: HttpRequest, year: Optional[int] = None, week: Optional[i ...@@ -138,6 +142,7 @@ def week_view(request: HttpRequest, year: Optional[int] = None, week: Optional[i
context['week'] = wanted_week context['week'] = wanted_week
context['lesson_periods'] = lesson_periods context['lesson_periods'] = lesson_periods
context['persons'] = persons context['persons'] = persons
context['group'] = group
context['select_form'] = select_form context['select_form'] = select_form
week_prev = wanted_week - 1 week_prev = wanted_week - 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment