Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn Django Admin users editing Collections [FC-0062] #233

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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