-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Dear @asyncee,
I need to have a select2 widget in the Django administrator for the FilePathField field. I looked at the source code and for this purpose, we just need to have another condition along with CharField and ForeignKey in select2_modelform_meta function utils.py.
from django.db.models import ForeignKey, FilePathField
def select2_modelform_meta(model,
meta_fields=None,
widgets=None,
attrs=None,
**kwargs):
.
.
.
for field in model._meta.fields:
if isinstance(field, ForeignKey) or field.choices or isinstance(field, FilePathField):
widgets.update({field.name: Select2(select2attrs=attrs)})
I didn't have permission to push it to a new branch. If possible, please enable the select2 widget to FilePathField.
Cheers
Mo
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels