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
fc83773b
Commit
fc83773b
authored
Sep 27, 2017
by
Clinton Blackburn
Committed by
Clinton Blackburn
Sep 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Django admin to show history for Publisher models
parent
ddf50371
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
10 deletions
+66
-10
course_discovery/apps/publisher/admin.py
+10
-9
course_discovery/apps/publisher/migrations/0059_auto_20170928_0425.py
+55
-0
requirements/base.txt
+1
-1
No files found.
course_discovery/apps/publisher/admin.py
View file @
fc83773b
from
django.contrib
import
admin
from
django.contrib.auth.admin
import
UserAdmin
from
django.contrib.auth.models
import
Group
from
guardian.admin
import
GuardedModelAdmin
from
guardian.admin
import
GuardedModelAdminMixin
from
simple_history.admin
import
SimpleHistoryAdmin
from
course_discovery.apps.publisher.assign_permissions
import
assign_permissions
from
course_discovery.apps.publisher.choices
import
InternalUserRole
...
...
@@ -16,14 +17,14 @@ from course_discovery.apps.publisher.models import (Course, CourseRun, CourseRun
@admin.register
(
CourseUserRole
)
class
CourseUserRoleAdmin
(
admin
.
Model
Admin
):
class
CourseUserRoleAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'changed_by'
,
'course'
,
'user'
,)
list_display
=
[
'role'
,
'course'
,
'user'
]
search_fields
=
[
'course__title'
]
@admin.register
(
OrganizationExtension
)
class
OrganizationExtensionAdmin
(
GuardedModelAdmin
):
class
OrganizationExtensionAdmin
(
GuardedModelAdmin
Mixin
,
SimpleHistoryAdmin
):
form
=
OrganizationExtensionForm
list_display
=
[
'organization'
,
'group'
]
search_fields
=
[
'organization__name'
,
'group__name'
]
...
...
@@ -39,7 +40,7 @@ class UserAttributesAdmin(admin.ModelAdmin):
@admin.register
(
OrganizationUserRole
)
class
OrganizationUserRoleAdmin
(
admin
.
Model
Admin
):
class
OrganizationUserRoleAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'user'
,
'organization'
,)
list_display
=
[
'role'
,
'organization'
,
'user'
]
search_fields
=
[
'organization__name'
]
...
...
@@ -69,7 +70,7 @@ class OrganizationUserRoleAdmin(admin.ModelAdmin):
@admin.register
(
CourseState
)
class
CourseStateAdmin
(
admin
.
Model
Admin
):
class
CourseStateAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'changed_by'
,)
list_display
=
[
'id'
,
'name'
,
'approved_by_role'
,
'owner_role'
,
'course'
,
'marketing_reviewed'
]
search_fields
=
[
'id'
,
'course__title'
]
...
...
@@ -77,7 +78,7 @@ class CourseStateAdmin(admin.ModelAdmin):
@admin.register
(
CourseRunState
)
class
CourseRunStateAdmin
(
admin
.
Model
Admin
):
class
CourseRunStateAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'changed_by'
,)
list_display
=
[
'id'
,
'name'
,
'approved_by_role'
,
'owner_role'
,
'course_run'
,
'owner_role_modified'
,
'preview_accepted'
]
...
...
@@ -87,14 +88,14 @@ class CourseRunStateAdmin(admin.ModelAdmin):
@admin.register
(
Course
)
class
CourseAdmin
(
admin
.
Model
Admin
):
class
CourseAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'changed_by'
,)
list_display
=
[
'title'
,
'number'
]
search_fields
=
[
'title'
,
'number'
]
@admin.register
(
CourseRun
)
class
CourseRunAdmin
(
admin
.
Model
Admin
):
class
CourseRunAdmin
(
SimpleHistory
Admin
):
form
=
CourseRunAdminForm
raw_id_fields
=
(
'changed_by'
,)
list_display
=
[
'course_name'
,
'lms_course_id'
,
'start'
,
'end'
]
...
...
@@ -105,7 +106,7 @@ class CourseRunAdmin(admin.ModelAdmin):
@admin.register
(
Seat
)
class
SeatAdmin
(
admin
.
Model
Admin
):
class
SeatAdmin
(
SimpleHistory
Admin
):
raw_id_fields
=
(
'changed_by'
,)
list_display
=
[
'course_run'
,
'type'
]
search_fields
=
[
'course_run__course__title'
,
'type'
]
...
...
course_discovery/apps/publisher/migrations/0059_auto_20170928_0425.py
0 → 100644
View file @
fc83773b
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-28 04:25
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0058_auto_20170927_1758'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'historicalcourse'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcourserun'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcourserunstate'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcoursestate'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalcourseuserrole'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalorganizationextension'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalorganizationuserrole'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'historicalseat'
,
name
=
'history_change_reason'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
]
requirements/base.txt
View file @
fc83773b
...
...
@@ -12,7 +12,7 @@ django-fsm==2.6.0
django-guardian==1.4.8
django-haystack==2.5.0
django-libsass==0.7
django-simple-history==1.
8.1
django-simple-history==1.
9.0
django-solo==1.1.2
django-sortedm2m==1.4.0
django-stdimage==2.4.1
...
...
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