2011-12-15 26 views

Respuesta

71

Se podría utilizar el with template tag, y asignar una variable de plantilla interna de la siguiente manera:

{% with restaurant_id=restaurant.id %} 
... use restaurant_id in this template section ... 
{% endwith %} 
14

Nota: Puede utilizar filtros en el "con" etiqueta de plantilla:

foo is {{ foo }} 
{% with bar=foo|slice'6:9' %} 
    bar is {{ bar }} 
{% endwith %} 
Cuestiones relacionadas