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:
Julia Eskew
2021-06-02 17:33:03 -04:00
committed by GitHub
parent 8bcf248339
commit f88a44d8dd
3 changed files with 3 additions and 33 deletions

View File

@@ -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,