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
52f96132
Commit
52f96132
authored
Aug 04, 2014
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an optional description field to course modes.
parent
3d942503
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
12 deletions
+78
-12
common/djangoapps/course_modes/migrations/0007_add_description.py
+45
-0
common/djangoapps/course_modes/models.py
+18
-3
common/djangoapps/course_modes/views.py
+1
-0
common/templates/course_modes/choose.html
+14
-9
No files found.
common/djangoapps/course_modes/migrations/0007_add_description.py
0 → 100644
View file @
52f96132
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding field 'CourseMode.description'
db
.
add_column
(
'course_modes_coursemode'
,
'description'
,
self
.
gf
(
'django.db.models.fields.TextField'
)(
null
=
True
,
blank
=
True
),
keep_default
=
False
)
# Changing field 'CourseMode.course_id'
db
.
alter_column
(
'course_modes_coursemode'
,
'course_id'
,
self
.
gf
(
'xmodule_django.models.CourseKeyField'
)(
max_length
=
255
))
def
backwards
(
self
,
orm
):
# Deleting field 'CourseMode.description'
db
.
delete_column
(
'course_modes_coursemode'
,
'description'
)
# Changing field 'CourseMode.course_id'
db
.
alter_column
(
'course_modes_coursemode'
,
'course_id'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
255
))
models
=
{
'course_modes.coursemode'
:
{
'Meta'
:
{
'unique_together'
:
"(('course_id', 'mode_slug', 'currency'),)"
,
'object_name'
:
'CourseMode'
},
'course_id'
:
(
'xmodule_django.models.CourseKeyField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
}),
'currency'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'usd'"
,
'max_length'
:
'8'
}),
'description'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'expiration_date'
:
(
'django.db.models.fields.DateField'
,
[],
{
'default'
:
'None'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'expiration_datetime'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'None'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'min_price'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'default'
:
'0'
}),
'mode_display_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
}),
'mode_slug'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'suggested_prices'
:
(
'django.db.models.fields.CommaSeparatedIntegerField'
,
[],
{
'default'
:
"''"
,
'max_length'
:
'255'
,
'blank'
:
'True'
})
}
}
complete_apps
=
[
'course_modes'
]
\ No newline at end of file
common/djangoapps/course_modes/models.py
View file @
52f96132
...
@@ -11,7 +11,17 @@ from django.db.models import Q
...
@@ -11,7 +11,17 @@ from django.db.models import Q
from
xmodule_django.models
import
CourseKeyField
from
xmodule_django.models
import
CourseKeyField
Mode
=
namedtuple
(
'Mode'
,
[
'slug'
,
'name'
,
'min_price'
,
'suggested_prices'
,
'currency'
,
'expiration_datetime'
])
Mode
=
namedtuple
(
'Mode'
,
[
'slug'
,
'name'
,
'min_price'
,
'suggested_prices'
,
'currency'
,
'expiration_datetime'
,
'description'
])
class
CourseMode
(
models
.
Model
):
class
CourseMode
(
models
.
Model
):
"""
"""
...
@@ -42,7 +52,11 @@ class CourseMode(models.Model):
...
@@ -42,7 +52,11 @@ class CourseMode(models.Model):
expiration_datetime
=
models
.
DateTimeField
(
default
=
None
,
null
=
True
,
blank
=
True
)
expiration_datetime
=
models
.
DateTimeField
(
default
=
None
,
null
=
True
,
blank
=
True
)
DEFAULT_MODE
=
Mode
(
'honor'
,
_
(
'Honor Code Certificate'
),
0
,
''
,
'usd'
,
None
)
# optional description override
# WARNING: will not be localized
description
=
models
.
TextField
(
null
=
True
,
blank
=
True
)
DEFAULT_MODE
=
Mode
(
'honor'
,
_
(
'Honor Code Certificate'
),
0
,
''
,
'usd'
,
None
,
None
)
DEFAULT_MODE_SLUG
=
'honor'
DEFAULT_MODE_SLUG
=
'honor'
class
Meta
:
class
Meta
:
...
@@ -66,7 +80,8 @@ class CourseMode(models.Model):
...
@@ -66,7 +80,8 @@ class CourseMode(models.Model):
mode
.
min_price
,
mode
.
min_price
,
mode
.
suggested_prices
,
mode
.
suggested_prices
,
mode
.
currency
,
mode
.
currency
,
mode
.
expiration_datetime
mode
.
expiration_datetime
,
mode
.
description
)
for
mode
in
found_course_modes
])
)
for
mode
in
found_course_modes
])
if
not
modes
:
if
not
modes
:
modes
=
[
cls
.
DEFAULT_MODE
]
modes
=
[
cls
.
DEFAULT_MODE
]
...
...
common/djangoapps/course_modes/views.py
View file @
52f96132
...
@@ -71,6 +71,7 @@ class ChooseModeView(View):
...
@@ -71,6 +71,7 @@ class ChooseModeView(View):
context
[
"currency"
]
=
modes
[
"verified"
]
.
currency
.
upper
()
context
[
"currency"
]
=
modes
[
"verified"
]
.
currency
.
upper
()
context
[
"min_price"
]
=
modes
[
"verified"
]
.
min_price
context
[
"min_price"
]
=
modes
[
"verified"
]
.
min_price
context
[
"verified_name"
]
=
modes
[
"verified"
]
.
name
context
[
"verified_name"
]
=
modes
[
"verified"
]
.
name
context
[
"verified_description"
]
=
modes
[
"verified"
]
.
description
return
render_to_response
(
"course_modes/choose.html"
,
context
)
return
render_to_response
(
"course_modes/choose.html"
,
context
)
...
...
common/templates/course_modes/choose.html
View file @
52f96132
...
@@ -72,16 +72,21 @@ $(document).ready(function() {
...
@@ -72,16 +72,21 @@ $(document).ready(function() {
<h4
class=
"title"
>
${verified_name}
</h4>
<h4
class=
"title"
>
${verified_name}
</h4>
%endif
%endif
%if verified_name == "Verified Certificate":
%if upgrade:
%if upgrade:
<div
class=
"copy"
>
<div
class=
"copy"
>
<p>
${_("Upgrade and work toward a verified Certificate of Achievement.")}
</p>
<p>
${_("Upgrade and work toward a verified Certificate of Achievement.")}
</p>
</div>
</div>
%else:
<div
class=
"copy"
>
<p>
${_("Sign up and work toward a verified Certificate of Achievement.")}
</p>
</div>
%endif
%else:
%else:
<div
class=
"copy"
>
<div
class=
"copy"
>
<p>
${_("Sign up and work toward a verified Certificate of Achievement.")
}
</p>
<p>
${verified_description
}
</p>
</div>
</div>
%endif
%endif
</div>
</div>
<div
class=
"field field-certificate-contribution"
>
<div
class=
"field field-certificate-contribution"
>
...
...
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