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
a87c8810
Commit
a87c8810
authored
Apr 09, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-612 Mobile Push Notification Studio Django admin setting
parent
2fed57a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
1 deletions
+106
-1
cms/djangoapps/contentstore/admin.py
+2
-1
cms/djangoapps/contentstore/migrations/0003_auto__add_pushnotificationconfig.py
+81
-0
cms/djangoapps/contentstore/models.py
+4
-0
cms/djangoapps/contentstore/tests/tests.py
+14
-0
common/djangoapps/config_models/models.py
+5
-0
No files found.
cms/djangoapps/contentstore/admin.py
View file @
a87c8810
...
@@ -5,6 +5,7 @@ Admin site bindings for contentstore
...
@@ -5,6 +5,7 @@ Admin site bindings for contentstore
from
django.contrib
import
admin
from
django.contrib
import
admin
from
config_models.admin
import
ConfigurationModelAdmin
from
config_models.admin
import
ConfigurationModelAdmin
from
contentstore.models
import
VideoUploadConfig
from
contentstore.models
import
VideoUploadConfig
,
PushNotificationConfig
admin
.
site
.
register
(
VideoUploadConfig
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
VideoUploadConfig
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
PushNotificationConfig
,
ConfigurationModelAdmin
)
cms/djangoapps/contentstore/migrations/0003_auto__add_pushnotificationconfig.py
0 → 100644
View file @
a87c8810
# -*- coding: utf-8 -*-
from
south.utils
import
datetime_utils
as
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding model 'PushNotificationConfig'
db
.
create_table
(
'contentstore_pushnotificationconfig'
,
(
(
'id'
,
self
.
gf
(
'django.db.models.fields.AutoField'
)(
primary_key
=
True
)),
(
'change_date'
,
self
.
gf
(
'django.db.models.fields.DateTimeField'
)(
auto_now_add
=
True
,
blank
=
True
)),
(
'changed_by'
,
self
.
gf
(
'django.db.models.fields.related.ForeignKey'
)(
to
=
orm
[
'auth.User'
],
null
=
True
,
on_delete
=
models
.
PROTECT
)),
(
'enabled'
,
self
.
gf
(
'django.db.models.fields.BooleanField'
)(
default
=
False
)),
))
db
.
send_create_signal
(
'contentstore'
,
[
'PushNotificationConfig'
])
def
backwards
(
self
,
orm
):
# Deleting model 'PushNotificationConfig'
db
.
delete_table
(
'contentstore_pushnotificationconfig'
)
models
=
{
'auth.group'
:
{
'Meta'
:
{
'object_name'
:
'Group'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'80'
}),
'permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
})
},
'auth.permission'
:
{
'Meta'
:
{
'ordering'
:
"('content_type__app_label', 'content_type__model', 'codename')"
,
'unique_together'
:
"(('content_type', 'codename'),)"
,
'object_name'
:
'Permission'
},
'codename'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'content_type'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['contenttypes.ContentType']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
})
},
'auth.user'
:
{
'Meta'
:
{
'object_name'
:
'User'
},
'date_joined'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'email'
:
(
'django.db.models.fields.EmailField'
,
[],
{
'max_length'
:
'75'
,
'blank'
:
'True'
}),
'first_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'groups'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Group']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'is_active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'is_staff'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'is_superuser'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'last_login'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'last_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'password'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'128'
}),
'user_permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'30'
})
},
'contentstore.pushnotificationconfig'
:
{
'Meta'
:
{
'object_name'
:
'PushNotificationConfig'
},
'change_date'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'changed_by'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
,
'null'
:
'True'
,
'on_delete'
:
'models.PROTECT'
}),
'enabled'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
})
},
'contentstore.videouploadconfig'
:
{
'Meta'
:
{
'object_name'
:
'VideoUploadConfig'
},
'change_date'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'changed_by'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
,
'null'
:
'True'
,
'on_delete'
:
'models.PROTECT'
}),
'enabled'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'profile_whitelist'
:
(
'django.db.models.fields.TextField'
,
[],
{
'blank'
:
'True'
})
},
'contenttypes.contenttype'
:
{
'Meta'
:
{
'ordering'
:
"('name',)"
,
'unique_together'
:
"(('app_label', 'model'),)"
,
'object_name'
:
'ContentType'
,
'db_table'
:
"'django_content_type'"
},
'app_label'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'model'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
})
}
}
complete_apps
=
[
'contentstore'
]
\ No newline at end of file
cms/djangoapps/contentstore/models.py
View file @
a87c8810
...
@@ -19,3 +19,7 @@ class VideoUploadConfig(ConfigurationModel):
...
@@ -19,3 +19,7 @@ class VideoUploadConfig(ConfigurationModel):
def
get_profile_whitelist
(
cls
):
def
get_profile_whitelist
(
cls
):
"""Get the list of profiles to include in the encoding download"""
"""Get the list of profiles to include in the encoding download"""
return
[
profile
for
profile
in
cls
.
current
()
.
profile_whitelist
.
split
(
","
)
if
profile
]
return
[
profile
for
profile
in
cls
.
current
()
.
profile_whitelist
.
split
(
","
)
if
profile
]
class
PushNotificationConfig
(
ConfigurationModel
):
"""Configuration for mobile push notifications."""
cms/djangoapps/contentstore/tests/tests.py
View file @
a87c8810
...
@@ -6,12 +6,14 @@ import mock
...
@@ -6,12 +6,14 @@ import mock
import
unittest
import
unittest
from
ddt
import
ddt
,
data
,
unpack
from
ddt
import
ddt
,
data
,
unpack
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
contentstore.models
import
PushNotificationConfig
from
contentstore.tests.utils
import
parse_json
,
user
,
registration
,
AjaxEnabledTestClient
from
contentstore.tests.utils
import
parse_json
,
user
,
registration
,
AjaxEnabledTestClient
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.tests.test_course_settings
import
CourseTestCase
...
@@ -349,3 +351,15 @@ class CourseKeyVerificationTestCase(CourseTestCase):
...
@@ -349,3 +351,15 @@ class CourseKeyVerificationTestCase(CourseTestCase):
)
)
resp
=
self
.
client
.
get_html
(
url
)
resp
=
self
.
client
.
get_html
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
status_code
)
self
.
assertEqual
(
resp
.
status_code
,
status_code
)
class
PushNotificationConfigTestCase
(
TestCase
):
"""
Tests PushNotificationConfig.
"""
def
test_notifications_defaults
(
self
):
self
.
assertFalse
(
PushNotificationConfig
.
is_enabled
())
def
test_notifications_enabled
(
self
):
PushNotificationConfig
(
enabled
=
True
)
.
save
()
self
.
assertTrue
(
PushNotificationConfig
.
is_enabled
())
common/djangoapps/config_models/models.py
View file @
a87c8810
...
@@ -60,3 +60,8 @@ class ConfigurationModel(models.Model):
...
@@ -60,3 +60,8 @@ class ConfigurationModel(models.Model):
cache
.
set
(
cls
.
cache_key_name
(),
current
,
cls
.
cache_timeout
)
cache
.
set
(
cls
.
cache_key_name
(),
current
,
cls
.
cache_timeout
)
return
current
return
current
@classmethod
def
is_enabled
(
cls
):
"""Returns True if this feature is configured as enabled, else False."""
return
cls
.
current
()
.
enabled
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