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
234c1805
Commit
234c1805
authored
Sep 17, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inherit from JSONField rather than Field for json-based fields
parent
d60117d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
common/lib/xmodule/xmodule/fields.py
+4
-4
No files found.
common/lib/xmodule/xmodule/fields.py
View file @
234c1805
...
@@ -2,7 +2,7 @@ import time
...
@@ -2,7 +2,7 @@ import time
import
logging
import
logging
import
re
import
re
from
xblock.fields
import
Field
from
xblock.fields
import
JSON
Field
import
datetime
import
datetime
import
dateutil.parser
import
dateutil.parser
...
@@ -11,7 +11,7 @@ from pytz import UTC
...
@@ -11,7 +11,7 @@ from pytz import UTC
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
class
Date
(
Field
):
class
Date
(
JSON
Field
):
'''
'''
Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.
Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.
'''
'''
...
@@ -85,7 +85,7 @@ class Date(Field):
...
@@ -85,7 +85,7 @@ class Date(Field):
TIMEDELTA_REGEX
=
re
.
compile
(
r'^((?P<days>\d+?) day(?:s?))?(\s)?((?P<hours>\d+?) hour(?:s?))?(\s)?((?P<minutes>\d+?) minute(?:s)?)?(\s)?((?P<seconds>\d+?) second(?:s)?)?$'
)
TIMEDELTA_REGEX
=
re
.
compile
(
r'^((?P<days>\d+?) day(?:s?))?(\s)?((?P<hours>\d+?) hour(?:s?))?(\s)?((?P<minutes>\d+?) minute(?:s)?)?(\s)?((?P<seconds>\d+?) second(?:s)?)?$'
)
class
Timedelta
(
Field
):
class
Timedelta
(
JSON
Field
):
# Timedeltas are immutable, see http://docs.python.org/2/library/datetime.html#available-types
# Timedeltas are immutable, see http://docs.python.org/2/library/datetime.html#available-types
MUTABLE
=
False
MUTABLE
=
False
...
@@ -133,7 +133,7 @@ class Timedelta(Field):
...
@@ -133,7 +133,7 @@ class Timedelta(Field):
return
self
.
from_json
(
value
)
return
self
.
from_json
(
value
)
class
RelativeTime
(
Field
):
class
RelativeTime
(
JSON
Field
):
"""
"""
Field for start_time and end_time video module properties.
Field for start_time and end_time video module properties.
...
...
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