Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
384e0bff
Commit
384e0bff
authored
Jan 07, 2017
by
Awais
Committed by
Awais Qureshi
Jan 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrating Admin for assigning permissions.
Ecom-6713
parent
5444b932
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletions
+34
-1
course_discovery/apps/publisher/admin.py
+6
-1
course_discovery/apps/publisher/migrations/0027_remove_old_permissions.py
+28
-0
No files found.
course_discovery/apps/publisher/admin.py
View file @
384e0bff
from
django.contrib
import
admin
from
guardian.admin
import
GuardedModelAdmin
from
course_discovery.apps.publisher.models
import
(
Course
,
CourseRun
,
CourseUserRole
,
OrganizationExtension
,
OrganizationUserRole
,
Seat
,
State
,
UserAttributes
...
...
@@ -6,7 +7,6 @@ from course_discovery.apps.publisher.models import (
admin
.
site
.
register
(
Course
)
admin
.
site
.
register
(
CourseRun
)
admin
.
site
.
register
(
OrganizationExtension
)
admin
.
site
.
register
(
OrganizationUserRole
)
admin
.
site
.
register
(
Seat
)
admin
.
site
.
register
(
State
)
...
...
@@ -16,3 +16,8 @@ admin.site.register(UserAttributes)
@admin.register
(
CourseUserRole
)
class
CourseUserRoleAdmin
(
admin
.
ModelAdmin
):
raw_id_fields
=
(
'user'
,)
@admin.register
(
OrganizationExtension
)
class
OrganizationExtensionAdmin
(
GuardedModelAdmin
):
pass
course_discovery/apps/publisher/migrations/0027_remove_old_permissions.py
0 → 100644
View file @
384e0bff
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
def
remove_permissions
(
apps
,
schema_editor
):
# Few permissions renamed but remains in db. Removing them now.
Permission
=
apps
.
get_model
(
'auth'
,
'Permission'
)
ContentType
=
apps
.
get_model
(
'contenttypes'
,
'ContentType'
)
OrganizationExtension
=
apps
.
get_model
(
'publisher'
,
'OrganizationExtension'
)
org_ext_content_type
=
ContentType
.
objects
.
get_for_model
(
OrganizationExtension
)
Permission
.
objects
.
filter
(
content_type
=
org_ext_content_type
,
codename__in
=
[
'view_course_run'
,
'edit_course_run'
]
)
.
delete
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0026_create_switch_hide_features_for_pilot'
),
(
'auth'
,
'0006_require_contenttypes_0002'
),
]
operations
=
[
migrations
.
RunPython
(
remove_permissions
,
reverse_code
=
migrations
.
RunPython
.
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