Задать вопрос

Тел: +7 965 3737 888

474

Просмотров

2

Ответов

Refactor template files to use {% block %} tags.

<p>Refactors two similar django template files  to use {% block %} tags.</p>
<p>Takes two template files, where one is a modified version of the other, and looks for differences and similiarities between the two.</p>
<p>It then generates refactored (and renamed) versions of each file and a third 'base' file, adding an {% extends %} tag as appropriate.</p>
<p>Block tags are named with matching numbers in all 3 files, making it easy to do a search and replace with more meaningful labels.</p>
<p>sample_data_in_base controls whether or not the content from file 1 is copied into place in the base file as an example.</p>
<p>Problems: it doesn't identify open {% for %} or {% if %} tags, so this needs some manual fixing (moving the {% endfor %} and {% endif %} tags into the proper blocks). It doesn't add the correct path for the {% extends %} tag either (ie. "app/base.html").  collapse_whitespace is not working at all.</p>

Вопрос полезен? Да0/Нет0
file_5137.py(1.6Кб)
None

Ответы (2):

Ответrodrigoc:15.08.2008
Ответ полезен? Да0/Нет0

Woops. Sorry!

Ответandybak:13.08.2008
Ответ полезен? Да0/Нет0

WARNING

I already had a base.html and it overwrote it without a prompt. Now that will teach me about reading the instructions and remembering to use version control!