-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collections Django Admin + soft delete, hard delete, and restore (#229)
* feat: adds delete_collection and restore_collection to api * feat: adds Django Admin for Collection model * feat: adds get_collection_components to the authoring api * chore: bumps version to 0.11.0 * chore: adds import-lint to quality make target
- Loading branch information
1 parent
8ae750e
commit d550aab
Showing
6 changed files
with
221 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
Open edX Learning ("Learning Core"). | ||
""" | ||
__version__ = "0.12.0" | ||
__version__ = "0.13.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Django Admin pages for Collection models. | ||
""" | ||
from django.contrib import admin | ||
|
||
from .models import Collection | ||
|
||
|
||
class CollectionAdmin(admin.ModelAdmin): | ||
""" | ||
The Collection model admin. | ||
Allows users to easily disable/enable (aka soft delete and restore) or bulk delete Collections. | ||
""" | ||
readonly_fields = ["key", "learning_package"] | ||
list_filter = ["enabled"] | ||
list_display = ["key", "title", "enabled", "modified"] | ||
list_editable = ["enabled"] | ||
|
||
def has_add_permission(self, request, *args, **kwargs): | ||
""" | ||
Disallow adding new collections via Django Admin. | ||
""" | ||
return False # pragma: no cover | ||
|
||
|
||
admin.site.register(Collection, CollectionAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.