forked from openedx/openedx-platform
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathadmin.py
More file actions
32 lines (27 loc) · 736 Bytes
/
admin.py
File metadata and controls
32 lines (27 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Admin site for content libraries
"""
from django.contrib import admin
from .models import ContentLibrary
@admin.register(ContentLibrary)
class ContentLibraryAdmin(admin.ModelAdmin):
"""
Definition of django admin UI for Content Libraries
"""
fields = (
"library_key",
"org",
"slug",
"allow_public_learning",
"allow_public_read",
"authorized_lti_configs",
)
list_display = ("slug", "org",)
def get_readonly_fields(self, request, obj=None):
"""
Ensure that 'slug' and 'uuid' cannot be edited after creation.
"""
if obj:
return ["library_key", "org", "slug"]
else:
return ["library_key", ]