Skip to content

Commit

Permalink
Fix Select2AdminMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
codingjoe committed Nov 5, 2022
1 parent 15790a3 commit 3781b67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django_select2/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,15 @@ def media(self):
class Select2AdminMixin:
"""Select2 mixin that uses Django's own select template."""

css_class_name = "admin-autocomplete"
theme = "admin-autocomplete"

@property
def media(self):
css = {**AutocompleteMixin(None, None).media._css}
css["screen"].append("django_select2/django_select2.css")
return forms.Media(
js=Select2Mixin().media._js,
css=AutocompleteMixin(None, None).media._css,
css=css,
)


Expand Down
1 change: 1 addition & 0 deletions tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def test_media(self):
"screen": [
"admin/css/vendor/select2/select2.min.css",
"admin/css/autocomplete.css",
"django_select2/django_select2.css",
]
}

Expand Down

0 comments on commit 3781b67

Please sign in to comment.