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
3969f0ca
Commit
3969f0ca
authored
Nov 07, 2016
by
Toby Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide a default configuration for forums if none already exists.
parent
fa2b1ae4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
common/djangoapps/django_comment_common/migrations/0003_enable_forums.py
+28
-0
No files found.
common/djangoapps/django_comment_common/migrations/0003_enable_forums.py
0 → 100644
View file @
3969f0ca
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
def
add_default_enable
(
apps
,
schema_editor
):
ForumsConfig
=
apps
.
get_model
(
"django_comment_common"
,
"ForumsConfig"
)
settings_count
=
ForumsConfig
.
objects
.
count
()
if
settings_count
is
0
:
# By default we want the comment client enabled, but this is *not* enabling
# discussions themselves by default, as in showing the Disucussions tab, or
# inline discussions, etc. It just allows the underlying service client to work.
settings
=
ForumsConfig
(
enabled
=
True
)
settings
.
save
()
def
reverse_noop
(
apps
,
schema_editor
):
return
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'django_comment_common'
,
'0002_forumsconfig'
),
]
operations
=
[
migrations
.
RunPython
(
add_default_enable
,
reverse_code
=
reverse_noop
),
]
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