-
Notifications
You must be signed in to change notification settings - Fork 92
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
conditional boolean attributes #111
Comments
Take a look at my fork: https://github.com/D3X/HamlPy
|
I would love to see this supported, @D3X any chance the change you made to your fork could easily be submitted as a pull request to the parent repo? (I could use your fork personally, but not on any of the collaborative projects I'm working on that could use this feature.) |
👍 |
1 similar comment
+1 |
@peterbehr @skatenerd @jlward Better late than never, I guess: #172 |
You often need to set boolean attributes (checked, selected,disabled) conditionally in a template
in Haml you can do something like:
which will evaluate to:
of course, Hamlpy cannot do this as it doesn't have access to runtime variables. a line like:
wlll always result in a disabled button, whatever the value of button_disabled
Any better solutions than the ones I have come up with?
very un-dry, especially if the element has a lot more attributes
Or just insert raw django template stuff:
being somewhat counter-intuitive when you have elected to use Haml
The text was updated successfully, but these errors were encountered: