django-material icon indicating copy to clipboard operation
django-material copied to clipboard

Custom widget support (Add s3direct)

Open talbenbasat opened this issue 7 years ago • 0 comments

Hi,

This isn't a bug but a request for help.

I wish to integrate https://github.com/bradleyg/django-s3direct with django-material.

This is the way I used it in my model

pgm_file = S3DirectField(dest='csv_maps')

Also tried a custom form and a field with widget as kwarg - without any success.

I see it reaching material/base.py line 195, with the correct widget. but then it rerenders it as a default input.

        try:
            if 'template' in options:
                template = select_template([
                    "{}/{}".format(template_pack, options['template'])
                ])
            elif 'widget' in options:
                widget_templates = [
                    '{}/fields/{}_{}.html'.format(
                        template_pack,
                        cls.__module__.split('.', 1)[0],
                        cls.__name__.lower()
                    )
                    for cls in type(options['widget']).mro()[:-2]
                ]
                template = select_template(widget_templates)
            else:
                template = _get_field_template(
                    template_pack, bound_field.field)

Thanks in advance Tal

talbenbasat avatar Nov 29 '17 09:11 talbenbasat