Even if there are no if interests|length > 0 I get the extra
whitespaces. Sam is correct. I've used Jinja2 before and used the - to
remove unnecessary lines.
I have lots of templates written for django, so I don't want to
retrofit them all. Worse case I could post process the message, but I
would
If you have a solution that is fine.
But if you did the business logic in the view, there is no need for
{%- if interests|length > 0 %} and you would simply return your
dictionary values while rendening as a variable that contains actual
values
and no need for the if statement which provides t
On 14 August 2011 14:00, Python_Junkie wrote:
> I think that if you performed the logic to determine if there actually
> is something in the interest for that row in the view and
> then only pass those components from the view, and not in the template
> then your problem goes away.
>
I don't thin
I think that if you performed the logic to determine if there actually
is something in the interest for that row in the view and
then only pass those components from the view, and not in the template
then your problem goes away.
On Aug 13, 8:53 pm, CrabbyPete wrote:
> I'm using the django templ
I'm using the django template system for format a text email. I send
it a dictionary and it formats the output. The problem is that it
inserts lots of newlines
Here is the template, and reports is a dictionary that contains an
event and a dictionary of interests
Weekly Contact List For {{date}}
{
Right, sorry! Read your question too quickly.
Peter
On 5/12/10 2:20 PM, "Noah Watkins" wrote:
> Peter
>
> I don't believe "spaceless" will work because in the example I posted
> there are no html tags within the block.
> Consider the same example where var2 is evaluated to be false:
>
>
>
I just stumbled upon this alternative too. Thanks for the reply, and
really I don't think it's too ugly.
On May 12, 11:50 am, zinckiwi wrote:
> Not the prettiest thing in the world, but there's always:
>
>
> header
> {% if var1 %}{{ ... }}
> {% endif %}{% if var2 %}{{ ... }}
> {% endif %
Not the prettiest thing in the world, but there's always:
header
{% if var1 %}{{ ... }}
{% endif %}{% if var2 %}{{ ... }}
{% endif %}{% if var3 %}{{ ... }}
{% endif %}
footer
Regards
Scott
On May 12, 2:20 pm, Noah Watkins wrote:
> Peter
>
> I don't believe "spaceless" will work be
Peter
I don't believe "spaceless" will work because in the example I posted
there are no html tags within the block.
Consider the same example where var2 is evaluated to be false:
header
...
--NEWLINE--
...
footer
The newline remains, but is displayed on a webpage because it is in
the
If you want to keep the newlines in your template, you can use
http://docs.djangoproject.com/en/1.1/ref/templates/builtins/#spaceless
Peter
On 5/12/10 2:02 PM, "Noah Watkins" wrote:
> I have a variable amount of lines that need to be displayed in a
> block:
>
>
> header
> {% if var1 %}{
I have a variable amount of lines that need to be displayed in a
block:
header
{% if var1 %}{{ ... }}{% endif %}
{% if var2 %}{{ ... }}{% endif %}
{% if var3 %}{{ ... }}{% endif %}
footer
However, if some of the if-statements are not evaluated to be true
then the line breaks are stil
11 matches
Mail list logo