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

Add check if user is owner of a group.

parent 465f51de
No related branches found
No related tags found
1 merge request!16Turn group week view into general week view.
......@@ -125,6 +125,11 @@ def week_view(request: HttpRequest, year: Optional[int] = None, week: Optional[i
group = Group.objects.get(pk=request.GET['group'])
lesson_periods = lesson_periods.filter(
Q(lesson__groups__pk=int(request.GET['group'])) | Q(lesson__groups__parent_groups__pk=int(request.GET['group'])))
elif hasattr(request, 'user') and hasattr(request.user, 'person'):
# Try to select group from owned groups of user
group = request.user.person.owner_of.first()
lesson_periods = lesson_periods.filter(
Q(lesson__groups__pk=int(request.GET['group'])) | Q(lesson__groups__parent_groups__pk=int(request.GET['group'])))
if 'teacher' in request.GET and request.GET['teacher']:
teacher = Person.objects.get(pk=request.GET['teacher'])
lesson_periods = lesson_periods.filter(
......
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