Skip to content
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

Optionally add attributes #15

Open
ironfroggy opened this issue Jan 28, 2015 · 2 comments
Open

Optionally add attributes #15

ironfroggy opened this issue Jan 28, 2015 · 2 comments

Comments

@ironfroggy
Copy link

Some attributes trigger behaviors and meanings simply by their presence, such as the readonly attribute. In these cases even an empty string passed to render_field will cause the field to have the readonly attribute and be read-only, so there is no way to do this and pass 'false' in any form.

In the way that render_field supports both = and += to set or append an attribute, a syntax to optionally add would be great. OR, explicit support for fields like readonly that would just ignore the attribute if the value given was false.

@kmike
Copy link
Collaborator

kmike commented Jan 28, 2015

I like the idea. Something like {% render_field form.text readonly?=value %}?
Pull requests are welcome.

Kos added a commit to Codility/django-widget-tweaks that referenced this issue May 19, 2016
@svengt
Copy link

svengt commented Jun 27, 2016

The pull request from @Kos looks pretty good! Any chance this will be merged soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants