English 中文(简体)
Django平原模板
原标题:Django plaintext template

目前,我正在撰写一个模板,该模板主要输出我的田地,它从数据库中提取内容,作为平原,以便能够下载(拟作为带子的配置文件)和装束的Im。

我经常这样做:

{% for model in modelqueryset %}
...
{% ifnotequal model.fieldx "" %}
    fieldx = {{ model.fieldx }}
{% endifnotequal %}
...
{% endfor %}

“. 长期清单/条目:

{% ifnotequal model.fieldy "" %}
    fieldy = {{ model.fieldy }}
{% endifnotequal %}

现在,如果实地实际上空洞,就会有一个空洞的线,但是,仅仅占用了不必要的空间,而且将难以读懂。 www.un.org/Depts/DGACM/index_french.htm

我如何消除这些空洞的界线? 我尝试了(1%的无空间%}...{%的无空间部分},它确实没有帮助。 我是否必须写一个习俗模板,或者我是否做过错或忽略什么?

Any help is appreciated and I will also already say Thanks

最佳回答

由于突破,你有空线。

... <- here
{% ifnotequal model.fieldx "" %}
    fieldx = {{ model.fieldx }}
{% endifnotequal %}

So you can rewrite it like this

...{% ifnotequal model.fieldx "" %}
       fieldx = {{ model.fieldx }}
   {% endifnotequal %}

Ortries

问题回答

你们不必使用一个模板来做所有事情——也许更容易使用一个简单的HttpResponse建筑商,并在Adhur建造产出案文:

>>> response = HttpResponse()
>>> response.write("<p>Here s the text of the Web page.</p>")
>>> response.write("<p>Here s another paragraph.</p>")




相关问题
Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

How to create a submit button template in Oracle APEX?

I m trying to create a template for a button in Oracle APEX but I don t seem to have access to the appropriate substitution strings to make it work. For non-templated buttons APEX seems to insert a ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Load ruby on rails template from database

I wonder if there is a way for me to store ruby on rails view files into database store and have that fetched directly from there. The reason is I want to create a CMS with all the user data stored in ...

Templated HTML Editor

I m looking for a HTML editor that kinda supports templated editing or live snippets or something like that. Background: I m working on a website for a friend. As there are no specifications what the ...

Dreamweaver changing path to site s reference instead of local

I have noticed recently, when I apply a template to a new HTML website, all the relative paths are pointed to my local files, example: file:///C|/webstuff/files but I cannot set them to relative paths ...

WPF ListView : Header styling

I want to have a ListView with columns and a particular style: The background for ALL column headers should be transparent except when the mouse is over in one of them. When this happends, the ...

热门标签