Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Réouven ASSOULY
zesje
Commits
e934a15e
Commit
e934a15e
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
add 'Students' resource for getting student list
parent
7fad559a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zesje/api.py
+2
-0
2 additions, 0 deletions
zesje/api.py
zesje/resources/students.py
+29
-0
29 additions, 0 deletions
zesje/resources/students.py
with
31 additions
and
0 deletions
zesje/api.py
+
2
−
0
View file @
e934a15e
...
...
@@ -4,6 +4,7 @@ from flask_restful import Api
from
.resources.graders
import
Graders
from
.resources.exams
import
Exams
,
ExamConfig
from
.resources.pdfs
import
Pdfs
from
.resources.students
import
Students
api_bp
=
Blueprint
(
__name__
,
__name__
)
...
...
@@ -20,3 +21,4 @@ api.add_resource(Graders, '/graders')
api
.
add_resource
(
Exams
,
'
/exams
'
)
api
.
add_resource
(
ExamConfig
,
'
/exams/<int:exam_id>
'
)
api
.
add_resource
(
Pdfs
,
'
/pdfs/<int:exam_id>
'
)
api
.
add_resource
(
Students
,
'
/students
'
)
This diff is collapsed.
Click to expand it.
zesje/resources/students.py
0 → 100644
+
29
−
0
View file @
e934a15e
from
flask_restful
import
Resource
from
pony
import
orm
from
..models
import
Student
class
Students
(
Resource
):
"""
Getting a list of students.
"""
@orm.db_session
def
get
(
self
):
"""
get all students for the course.
Returns
-------
list of:
id: int
first_name: str
last_name: str
email: str
"""
return
[
{
'
id
'
:
s
.
id
,
'
first_name
'
:
s
.
first_name
,
'
last_name
'
:
s
.
last_name
,
'
email
'
:
s
.
email
,
}
for
s
in
Student
.
select
()
]
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