TNL-8080 ][: Use module mixin and fix permissions for proxy models. (#27811)
* chore: Update Python requirements via pip-tools. Needed the newest edx-django-utils version. * refactor: Use the newly-added ReadOnlyAdminMixin from the updated module and remove the existing implementation. * fix: edx-platform now has a Django proxy model - CourseOutlineRegenerate. Without this fix, the permissions to the model's admin interface cannot be added to a group and successfully granted to users.
This commit is contained in:
@@ -103,7 +103,8 @@ class Command(BaseCommand): # lint-amnesty, pylint: disable=missing-class-docst
|
||||
except LookupError as exc:
|
||||
raise CommandError(str(exc)) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
content_type = ContentType.objects.get_for_model(model_class)
|
||||
# Fetch content type for model, including proxy models.
|
||||
content_type = ContentType.objects.get_for_model(model_class, for_concrete_model=False)
|
||||
try:
|
||||
new_permission = Permission.objects.get(
|
||||
content_type=content_type,
|
||||
|
||||
Reference in New Issue
Block a user