forked from apluslms/a-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewbase.py
More file actions
24 lines (18 loc) · 701 Bytes
/
Copy pathviewbase.py
File metadata and controls
24 lines (18 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from lib.viewbase import BaseMixin, BaseTemplateView
from authorization.permissions import ACCESS
class UserProfileMixin(BaseMixin):
access_mode = ACCESS.STUDENT
login_redirect = True
def get_resource_objects(self):
super().get_resource_objects()
user = self.request.user
if user.is_authenticated:
self.profile = profile = user.userprofile
self.is_external_student = profile.is_external
else:
self.profile = None
self.is_external_student = False
# Add available for template
self.note("profile", "is_external_student")
class UserProfileView(UserProfileMixin, BaseTemplateView):
pass