Skip to content

Custom widget support (Add s3direct) #362

Open
@talbenbasat

Description

@talbenbasat

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions