>
> {{include}}

An include like the above that doesn't reference a specific view only works 
when the view that contains it is extended by another view. So, if you want 
your cmsvcard/index.html card to extend the cmsvcard/generic.html view, you 
have to include an extend directive:

In /views/cmsvcard/index.html:

{{extend 'cmsvcard/generic.html'}}

In that case, the contents of cmsvcard/index.html will be included at the 
{{include}} point of cmsvcard/generic.html.
 

> {{if request.function=='relatedNames':}}
>
  {{include 'cmsvcard/relatedNames.html'}}
> {{pass}}
>
> ... which worked, until I added:
>
> {{if request.function=='social':}}
>   {{include 'cmsvcard/social.html'}}
> {{pass}}
>
> For some reason this results in an error ticket referencing a line of code 
> in the cmsvcard/relatedNames view:
>
> {{=row.Organization.name}}
>

{{include}} and {{extend}} directives are not Python code -- they are 
processed before any Python code is executed. So, when you put an 
{{include}} inside a Python if statement block, it does not conditionally 
include the referenced view. Rather, the view gets included no matter what, 
but the Python code generated from the view gets wrapped in your if 
statement -- so the Python code for the view is conditionally *executed*. 
If request.function=='relatedNames' is False, though, I wouldn't expect an 
error in the relatedNames view portion of the code. Is it possible that 
your relatedNames.html view has an extra {{pass}} statement somewhere 
before the {{=row.Organization.name}} line? That would prematurely end the {{if 
request.function=='relatedNames':}} block.

Anthony

Reply via email to