Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0434c493
Commit
0434c493
authored
Nov 16, 2017
by
Albert St. Aubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Entitlement enroll and unenroll logic to the Enrollment API
parent
96f35451
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
common/djangoapps/enrollment/views.py
+0
-0
common/djangoapps/entitlements/models.py
+23
-0
No files found.
common/djangoapps/enrollment/views.py
View file @
0434c493
This diff is collapsed.
Click to expand it.
common/djangoapps/entitlements/models.py
View file @
0434c493
...
...
@@ -24,3 +24,26 @@ class CourseEntitlement(TimeStampedModel):
help_text
=
'The current Course enrollment for this entitlement. If NULL the Learner has not enrolled.'
)
order_number
=
models
.
CharField
(
max_length
=
128
,
null
=
True
)
@classmethod
def
get_active_user_course_entitlements
(
cls
,
user
,
course_uuid
):
"""
Returns all the available sessions for a given course.
"""
try
:
entitlement
=
cls
.
objects
.
get
(
user
=
user
,
course_uuid
=
course_uuid
,
expired_at
=
None
,
)
return
entitlement
except
cls
.
DoesNotExist
:
return
None
@classmethod
def
set_enrollment
(
cls
,
entitlement
,
enrollment
):
"""
Fulfills an entitlement by specifying a session.
"""
cls
.
objects
.
filter
(
id
=
entitlement
.
id
)
.
update
(
enrollment_course_run
=
enrollment
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment