Skip to content

Commit

Permalink
Warn Django Admin users editing Collections [FC-0036] (#233)
Browse files Browse the repository at this point in the history
* docs: wrap collections edit page in a warning so users know to use Studio Django Admin instead of the LMS.
* docs: improve "enabled" flag help docs
* chore: bumps version to 0.13.1
  • Loading branch information
pomegranited authored Sep 26, 2024
1 parent d550aab commit da9adf8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openedx_learning/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Open edX Learning ("Learning Core").
"""
__version__ = "0.13.0"
__version__ = "0.13.1"
17 changes: 16 additions & 1 deletion openedx_learning/apps/authoring/collections/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Django Admin pages for Collection models.
"""
from django.contrib import admin
from django.utils.translation import gettext_lazy as _

from .models import Collection

Expand All @@ -15,7 +16,21 @@ class CollectionAdmin(admin.ModelAdmin):
readonly_fields = ["key", "learning_package"]
list_filter = ["enabled"]
list_display = ["key", "title", "enabled", "modified"]
list_editable = ["enabled"]
fieldsets = [
(
"",
{
"fields": ["key", "learning_package"],
}
),
(
_("Edit only in Studio"),
{
"fields": ["title", "enabled", "description", "created_by"],
"description": _("⚠ Changes made here should be done in Studio Django Admin, not the LMS."),
}
),
]

def has_add_permission(self, request, *args, **kwargs):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.15 on 2024-09-24 07:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('oel_collections', '0004_collection_key'),
]

operations = [
migrations.AlterField(
model_name='collection',
name='enabled',
field=models.BooleanField(default=True, help_text='Disabled collections are "soft deleted", and should be re-enabled before use, or be deleted.'),
),
]
4 changes: 1 addition & 3 deletions openedx_learning/apps/authoring/collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,10 @@ class Collection(models.Model):
}
)

# We don't have api functions to handle the enabled field. This is a placeholder for future use and
# a way to "soft delete" collections.
enabled = models.BooleanField(
default=True,
help_text=_(
"Whether the collection is enabled or not."
'Disabled collections are "soft deleted", and should be re-enabled before use, or be deleted.',
),
)

Expand Down

0 comments on commit da9adf8

Please sign in to comment.