#16146: Calling functions with arguments inside a template -------------------------------------+------------------------------------- Reporter: pmandel@… | Owner: nobody Type: New | Status: closed feature | Component: Template system Milestone: | Severity: Normal Version: 1.3 | Keywords: template, function Resolution: wontfix | Has patch: 0 Triage Stage: | Needs tests: 0 Unreviewed | Easy pickings: 0 Needs documentation: 0 | Patch needs improvement: 0 | -------------------------------------+------------------------------------- Changes (by julien):
* status: new => closed * needs_docs: => 0 * resolution: => wontfix * needs_tests: => 0 * needs_better_patch: => 0 Comment: Django actually prevents this by design. The idea is to keep most of the logic in views and keep the template language as simple as possible (so that it can easily be used by non tech-savvy designers, for example). Quoting from the doc: "Because Django intentionally limits the amount of logic processing available in the template language, it is not possible to pass arguments to method calls accessed from within templates. Data should be calculated in views, then passed to templates for display." (https://docs.djangoproject.com/en/1.3/topics/templates/#accessing-method- calls) So you'll have to do that in the view. Writing a custom template tag or filter might also be of good help. This is a common problem, so don't hesitate to ask on the django-users mailing list for more advice. -- Ticket URL: <https://code.djangoproject.com/ticket/16146#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.