32👍
✅
You can’t pass an argument to a callable attribute like this. Either pull the value in the view, or write a custom template tag to do it.
15👍
I agree with the philosophy of separating logic from design, but there’s an exception. I am currently writing a get_image(height=xxx, width=xxx) method for a model. Clearly, it should be up to the template designer to decide the size of the image as the last stage. Though I suppose the correct thing to do is write a custom tag, but why restrict?
👤Joe
- [Django]-Django and client-side javascript templates
- [Django]-Django Model MultipleChoice
- [Django]-Add additional options to Django form select widget
12👍
Here I wrote a hack to call a function and pass the arguments
http://www.sprklab.com/notes/13-passing-arguments-to-functions-in-django-template/
- [Django]-Django Projects as Desktop applications : how to?
- [Django]-Django, Docker, Python – Unable to install Pillow on python-alpine
- [Django]-Django 1.8 sending mail using gmail SMTP
Source:stackexchange.com