Skip to content

Commit

Permalink
Merge pull request #669 from openedx/zshkoor/django42-support
Browse files Browse the repository at this point in the history
fix: Added support for django42
  • Loading branch information
macdiesel authored Sep 25, 2023
2 parents 9aef117 + 4e696a5 commit 16b8f84
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
python-version: [py38]
django-version: [django32]
django-version: [django32, django42]

steps:
- uses: actions/checkout@v2
Expand Down
16 changes: 9 additions & 7 deletions enterprise_catalog/apps/catalog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ class CatalogQueryAdmin(UnchangeableMixin):
'content_filter_hash',
)

@admin.display(
description='Content Filter'
)
def get_content_filter(self, obj):
return obj.pretty_print_content_filter()

get_content_filter.short_description = 'Content Filter'

form = CatalogQueryForm


Expand All @@ -112,12 +112,13 @@ class EnterpriseCatalogAdmin(UnchangeableMixin):
'catalog_query__content_filter_hash__exact'
)

@admin.display(
description='Catalog Query'
)
def get_catalog_query(self, obj):
link = reverse("admin:catalog_catalogquery_change", args=[obj.catalog_query.id])
return format_html('<a href="{}">{}</a>', link, obj.catalog_query.pretty_print_content_filter())

get_catalog_query.short_description = 'Catalog Query'


@admin.register(EnterpriseCatalogRoleAssignment)
class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin):
Expand All @@ -130,6 +131,9 @@ class EnterpriseCatalogRoleAssignmentAdmin(UserRoleAssignmentAdmin):
'enterprise_id',
)

@admin.display(
description='User'
)
def get_username(self, obj):
return obj.user.username

Expand All @@ -143,7 +147,5 @@ class Meta:
fields = ('user', 'role', 'enterprise_id', 'applies_to_all_contexts')
form = EnterpriseCatalogRoleAssignmentAdminForm

get_username.short_description = 'User'


admin.site.register(CatalogUpdateCommandConfig, ConfigurationModelAdmin)
4 changes: 1 addition & 3 deletions enterprise_catalog/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from enterprise_catalog.apps.core.models import User


@admin.register(User)
class CustomUserAdmin(UserAdmin):
""" Admin configuration for the custom User model. """
list_display = ('username', 'email', 'full_name', 'first_name', 'last_name', 'is_staff')
Expand All @@ -17,6 +18,3 @@ class CustomUserAdmin(UserAdmin):
'groups', 'user_permissions')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)


admin.site.register(User, CustomUserAdmin)
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tox]
skipsdist = true
envlist = {py38}-django{32,40}
envlist = {py38}-django{32, 42}

[testenv]
deps =
django32: Django>=3.2,<4.0
django42: Django>=4.2,<4.3
django40: Django>=4.0,<4.1
-r{toxinidir}/requirements/test.txt
commands =
Expand Down

0 comments on commit 16b8f84

Please sign in to comment.