-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨(backend) add offer and price fields to courseRun #2466
Open
JoaoGarcao
wants to merge
1
commit into
openfun:master
Choose a base branch
from
JoaoGarcao:JoaoGarcao/issue/2451/model-add-price
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/richie/apps/courses/migrations/0035_courserun_offer_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Generated by Django 4.2.13 on 2024-07-09 10:56 | ||
|
||
from django.db import migrations, models | ||
|
||
import richie.apps.core.fields.multiselect | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("courses", "0034_auto_20230817_1736"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="courserun", | ||
name="offer", | ||
field=models.CharField( | ||
choices=[ | ||
( | ||
"free", | ||
"free - The entire course can be completed without cost", | ||
), | ||
( | ||
"partially_free", | ||
"partially_free - More than half of the course is for free", | ||
), | ||
( | ||
"subscription", | ||
"subscription - The user must be a subscriber or paid member in order to complete the entire course", | ||
), | ||
( | ||
"paid", | ||
"paid - The user must pay to complete the course", | ||
), | ||
], | ||
default="free", | ||
max_length=20, | ||
verbose_name="offer", | ||
), | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
src/richie/apps/courses/migrations/0036_courserun_price_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 4.2.13 on 2024-07-09 14:37 | ||
|
||
from django.db import migrations, models | ||
|
||
import richie.apps.core.fields.multiselect | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("courses", "0035_courserun_offer_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="courserun", | ||
name="price", | ||
field=models.FloatField( | ||
default=0.0, help_text="The cost of the course", verbose_name="price" | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,8 @@ class Meta: | |
"state", | ||
"enrollment_count", | ||
"catalog_visibility", | ||
"offer", | ||
"price", | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
from richie.apps.core.helpers import create_i18n_page | ||
from richie.apps.courses.factories import CourseFactory, CourseRunFactory | ||
from richie.apps.courses.models import CourseRun, CourseRunTranslation | ||
from richie.apps.courses.models.course import CourseRunCatalogVisibility | ||
from richie.apps.courses.models.course import CourseRunCatalogVisibility, CourseRunOffer | ||
|
||
|
||
# pylint: disable=too-many-public-methods | ||
|
@@ -623,6 +623,8 @@ def test_models_course_run_mark_dirty_any_field(self): | |
stub = CourseRunFactory( | ||
sync_mode="manual", | ||
catalog_visibility=CourseRunCatalogVisibility.COURSE_ONLY, | ||
offer=CourseRunOffer.SUBSCRIPTION, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JoaoGarcao You have to use the setting |
||
price=3.0, | ||
display_mode="compact", | ||
) # New random values to update our course run | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price
field could be returned as a float not a string.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a change to this, but I'm not sure if it's in line with what you asked for.