Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Maximilian Michal
grady
Commits
dac1282a
There was a problem fetching the pipeline summary.
Commit
dac1282a
authored
7 years ago
by
robinwilliam.hundt
Browse files
Options
Downloads
Patches
Plain Diff
Forgot the functional views
parent
0845f7bb
No related branches found
No related tags found
1 merge request
!23
Resolve "Logout of tutors after inactivity"
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/urls.py
+2
-1
2 additions, 1 deletion
core/urls.py
core/views.py
+11
-0
11 additions, 0 deletions
core/views.py
with
13 additions
and
1 deletion
core/urls.py
+
2
−
1
View file @
dac1282a
...
@@ -16,7 +16,8 @@ router.register(r'tutor', views.TutorApiViewSet)
...
@@ -16,7 +16,8 @@ router.register(r'tutor', views.TutorApiViewSet)
# regular views that are not viewsets
# regular views that are not viewsets
regular_views_urlpatterns
=
[
regular_views_urlpatterns
=
[
url
(
r
'
student-page
'
,
views
.
StudentSelfApiView
.
as_view
(),
name
=
'
student-page
'
),
url
(
r
'
student-page
'
,
views
.
StudentSelfApiView
.
as_view
(),
name
=
'
student-page
'
),
url
(
r
'
user-role
'
,
views
.
get_user_role
)
url
(
r
'
user-role
'
,
views
.
get_user_role
,
name
=
'
user-role
'
),
url
(
r
'
exam-module
'
,
views
.
get_exam_module
,
name
=
'
exam-module
'
),
]
]
urlpatterns
=
[
urlpatterns
=
[
...
...
This diff is collapsed.
Click to expand it.
core/views.py
+
11
−
0
View file @
dac1282a
...
@@ -17,6 +17,17 @@ def get_user_role(request):
...
@@ -17,6 +17,17 @@ def get_user_role(request):
return
Response
({
'
role
'
:
type
(
request
.
user
.
get_associated_user
()).
__name__
})
return
Response
({
'
role
'
:
type
(
request
.
user
.
get_associated_user
()).
__name__
})
@api_view
()
Alexander Wähling
@alexander.waehling
·
Dec 13, 2017
Delete this view and use the information from the student-page view instead
Delete this view and use the information from the student-page view instead
Jan Maximilian Michal
@j.michal
·
Dec 13, 2017
Owner
Jap.
Jap.
robinwilliam.hundt
@robinwilliam.hundt
·
Dec 17, 2017
Author
Maintainer
Done
Done
Please
register
or
sign in
to reply
def
get_exam_module
(
request
):
"""
Returns the module_reference of the first ExamType instance.
"""
# At the moment this solution is sufficient, since there is only one exam
# in the database at any one moment
if
ExamType
.
objects
.
count
()
>
0
:
return
Response
({
'
exam
'
:
ExamType
.
objects
.
get
(
pk
=
1
).
module_reference
})
else
:
return
Response
({
'
exam
'
:
'
No exam available
'
})
class
StudentSelfApiView
(
generics
.
RetrieveAPIView
):
class
StudentSelfApiView
(
generics
.
RetrieveAPIView
):
"""
Gets all data that belongs to one student
"""
"""
Gets all data that belongs to one student
"""
permission_classes
=
(
IsStudent
,)
permission_classes
=
(
IsStudent
,)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment