New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClearableFileInput widget doesn't handle initial_text, input_text and clear_checkbox_label #169

Closed
ghost opened this Issue Apr 1, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Apr 1, 2016

According to the docs you should be able to override the mentioned attributes, however setting them has no effect.

This is what I've done

class CustomClearableFileInput(floppy.ClearableFileInput):
    """Override template on ClearableFileInput.
    """
    clear_checkbox_label = 'Remove custom cover'

but the output shows the default text. As far as I can see ClearableFileInput doesn't actually use these attributes, despite the documentation saying:

The initial_text, input_text and clear_checkbox_label attributes are provided in the template context.

I've also tried:

custom_background = forms.ImageField(
        required=False,
        widget=forms.ClearableFileInput(
            attrs={
                'accept': ','.join(settings.ALLOWED_IMAGE_TYPES),
                'clear_checkbox_label': 'Remove custom cover'}
        ),
        validators=[image_format_validator]
    )

gregmuellegger added a commit that referenced this issue Apr 19, 2016

@gregmuellegger

This comment has been minimized.

Owner

gregmuellegger commented Apr 19, 2016

Hi, thanks for the report. I've added the labels as documented and released 1.6.2 that contains the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment