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
d3bbb86f
Commit
d3bbb86f
authored
Nov 09, 2017
by
bmedx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shims to fix test collection errors
parent
f3f8d8ec
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
15 deletions
+17
-15
cms/startup.py
+4
-1
common/djangoapps/third_party_auth/admin.py
+2
-1
lms/djangoapps/courseware/models.py
+3
-8
lms/startup.py
+4
-2
openedx/core/djangoapps/xmodule_django/models.py
+4
-3
No files found.
cms/startup.py
View file @
d3bbb86f
...
...
@@ -19,6 +19,9 @@ def run():
NOTE: DO **NOT** add additional code to this method or this file! The Platform Team
is moving all startup code to more standard locations using Django best practices.
"""
django_db_models_options
.
patch
()
# TODO: Remove Django 1.11 upgrade shim
# SHIM: We should be able to get rid of this monkey patch post-upgrade
if
django
.
VERSION
[
0
]
==
1
and
django
.
VERSION
[
1
]
<
10
:
django_db_models_options
.
patch
()
django
.
setup
()
common/djangoapps/third_party_auth/admin.py
View file @
d3bbb86f
...
...
@@ -116,9 +116,10 @@ class SAMLProviderDataAdmin(admin.ModelAdmin):
def
get_readonly_fields
(
self
,
request
,
obj
=
None
):
if
obj
:
# editing an existing object
return
self
.
model
.
_meta
.
get_all_field_names
()
# pylint: disable=protected-access
return
[
field
.
name
for
field
in
self
.
model
.
_meta
.
get_fields
()]
# pylint: disable=protected-access
return
self
.
readonly_fields
admin
.
site
.
register
(
SAMLProviderData
,
SAMLProviderDataAdmin
)
...
...
lms/djangoapps/courseware/models.py
View file @
d3bbb86f
...
...
@@ -257,14 +257,9 @@ class XBlockFieldBase(models.Model):
modified
=
models
.
DateTimeField
(
auto_now
=
True
,
db_index
=
True
)
def
__unicode__
(
self
):
return
u'{}<{!r}'
.
format
(
self
.
__class__
.
__name__
,
{
key
:
getattr
(
self
,
key
)
for
key
in
self
.
_meta
.
get_all_field_names
()
if
key
not
in
(
'created'
,
'modified'
)
}
)
# pylint: disable=protected-access
keys
=
[
field
.
name
for
field
in
self
.
_meta
.
get_fields
()
if
field
.
name
not
in
(
'created'
,
'modified'
)]
return
u'{}<{!r}'
.
format
(
self
.
__class__
.
__name__
,
{
key
:
getattr
(
self
,
key
)
for
key
in
keys
})
class
XModuleUserStateSummaryField
(
XBlockFieldBase
):
...
...
lms/startup.py
View file @
d3bbb86f
...
...
@@ -8,7 +8,6 @@ from django.conf import settings
from
openedx.core.djangoapps.monkey_patch
import
django_db_models_options
# Force settings to run so that the python path is modified
settings
.
INSTALLED_APPS
# pylint: disable=pointless-statement
...
...
@@ -19,6 +18,9 @@ def run():
NOTE: DO **NOT** add additional code to this method or this file! The Platform Team
is moving all startup code to more standard locations using Django best practices.
"""
django_db_models_options
.
patch
()
# TODO: Remove Django 1.11 upgrade shim
# SHIM: We should be able to get rid of this monkey patch post-upgrade
if
django
.
VERSION
[
0
]
==
1
and
django
.
VERSION
[
1
]
<
10
:
django_db_models_options
.
patch
()
django
.
setup
()
openedx/core/djangoapps/xmodule_django/models.py
View file @
d3bbb86f
...
...
@@ -36,13 +36,14 @@ class NoneToEmptyQuerySet(models.query.QuerySet):
"""
def
_filter_or_exclude
(
self
,
*
args
,
**
kwargs
):
# pylint: disable=protected-access
for
name
in
self
.
model
.
_meta
.
get_all_field_name
s
():
field_object
,
_model
,
direct
,
_m2m
=
self
.
model
.
_meta
.
get_field_by_name
(
name
)
for
field_object
in
self
.
model
.
_meta
.
get_field
s
():
direct
=
not
field_object
.
auto_created
or
field_object
.
concrete
if
direct
and
hasattr
(
field_object
,
'Empty'
):
for
suffix
in
(
''
,
'_exact'
):
key
=
'{}{}'
.
format
(
name
,
suffix
)
key
=
'{}{}'
.
format
(
field_object
.
name
,
suffix
)
if
key
in
kwargs
and
kwargs
[
key
]
is
None
:
kwargs
[
key
]
=
field_object
.
Empty
return
super
(
NoneToEmptyQuerySet
,
self
)
.
_filter_or_exclude
(
*
args
,
**
kwargs
)
...
...
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