<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Marcus Whybrow - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-11d99581" type="application/json"/><link>http://marcuswhybrow.disqus.com/</link><description>My personal blog</description><atom:link href="http://marcuswhybrow.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 30 Aug 2011 15:41:36 -0000</lastBuildDate><item><title>Re: Creating a Cacti Alternative</title><link>http://marcuswhybrow.net/cacti-alternative/#comment-298917794</link><description>ooooh eventlet and websockets .....now thats the business!&lt;br&gt;&lt;br&gt;Have you looked at Python Flask? I tried to get into Django and bfg.....they just seemed too big for what I wanted (small Intranet webapps for financial clients) .... step in Python Flask.&lt;br&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bruce Bushby</dc:creator><pubDate>Tue, 30 Aug 2011 15:41:36 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-140920763</link><description>XML based templating languages solve this by using "dummy" elements, and they often reformat the output as well I guess. But the example I gave would solve the problem in Django for the majority of cases. For the rest of the cases, you just:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;br&gt;&amp;lt;div&amp;gt;&lt;br&gt;    {% for post in posts %}&lt;br&gt;    &amp;lt;div&amp;gt;{{ post.title }}&amp;lt;/div&amp;gt; &lt;br&gt;    &amp;lt;div&amp;gt;{{ post.body }}&amp;lt;/div&amp;gt;&lt;br&gt;    {% endfor %}&lt;br&gt;&amp;lt;/div&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;It's not too bad because using XML based looping and conditional constructs will already give you the readability and indentation you want, so having a few "old-style" loops in the mix wouldn't affect the big picture.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Erik A.</dc:creator><pubDate>Fri, 04 Feb 2011 19:27:07 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-140801754</link><description>This would work nicely in the example you have provided, but this does not deal with repeating multiple elements. Moving the for loop definition to the parent &lt;code&gt;ul&lt;/code&gt; element would solve this issue, but introduces the new one of not including some elements in the iterative construction.&lt;br&gt;&lt;br&gt;I think it comes down to being a restrictive problem, yes you can gain the desired output which we have been talking about, but at the cost of preventing some common use cases.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Fri, 04 Feb 2011 15:57:02 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-140336241</link><description>The fundamental issue is that the Django templating language is not meant to integrate with HTML (or XML based languages in general). Imagine if instead of wrapping an element with a for-endfor pair, you could:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;br&gt;&amp;lt;ul&amp;gt;&lt;br&gt;    &amp;lt;li django:for="post in posts"&amp;gt;{{ post.title }}&amp;lt;/li&amp;gt;&lt;br&gt;&amp;lt;/ul&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;This would solve both the indenting issue, and the issue of duplication of information as the current &lt;code&gt;{% for %}{% endfor %}&lt;/code&gt; often duplicates the already existing structure.&lt;br&gt;&lt;br&gt;Since it would probably be hopeless to ask this to be added in a future version of Django, I've thought of layering another language such as TAL on top of Django, i.e. first process the template with TAL, and then send to Django templating.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Erik A.</dc:creator><pubDate>Fri, 04 Feb 2011 06:05:20 -0000</pubDate></item><item><title>Re: Django Preview</title><link>http://marcuswhybrow.net/django-preview/#comment-63080915</link><description>Form preview locks you into a certain workflow and assumes you want to apply your changes at the end. I also want to create something that can just be enabled in your models with some minimal configuration on your part.&lt;br&gt;&lt;br&gt;Maybe I could use form previews in order to emulate these features, but I think it would be too limiting.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Sun, 18 Jul 2010 17:00:14 -0000</pubDate></item><item><title>Re: Django Preview</title><link>http://marcuswhybrow.net/django-preview/#comment-63079071</link><description>Couldn't django.contrib.formtools.preview be used?
&lt;br&gt;
&lt;br&gt;&lt;a href="http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-preview/#ref-contrib-formtools-form-preview" rel="nofollow"&gt;http://docs.djangoproject.com/...&lt;/a&gt;
&lt;br&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jakub</dc:creator><pubDate>Sun, 18 Jul 2010 16:38:42 -0000</pubDate></item><item><title>Re: Creating a Cacti Alternative</title><link>http://marcuswhybrow.net/cacti-alternative/#comment-61737605</link><description>Google "mongodb ate my data"... It seems to me using another kv store like cassandra or even riak would be a much better idea.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jeff Schroeder</dc:creator><pubDate>Mon, 12 Jul 2010 12:45:56 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-61700250</link><description>Judging by the github README this:&lt;br&gt;&lt;pre&gt;%ul#atheletes&lt;br&gt;    - for athelete in athelete_list&lt;br&gt;        %li.athelete= &lt;a href="http://athelete.name" rel="nofollow"&gt;athelete.name&lt;/a&gt;&lt;/pre&gt;still turns into this:&lt;pre&gt;&amp;lt;ul id="atheletes"&amp;gt;&lt;br&gt;    {% for athelete in athelete_list %}&lt;br&gt;        &amp;lt;li class="athelete"&amp;gt;{{ &lt;a href="http://athelete.name" rel="nofollow"&gt;athelete.name&lt;/a&gt; }}&amp;lt;/li&amp;gt;&lt;br&gt;    {% endfor %}&lt;br&gt;&amp;lt;/ul&amp;gt;&lt;/pre&gt;Which doesn't solve the HTML indentation problem. However something like this could be the answer, and I have not looked at HamlPy in enough detail to know that it is not that answer.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Mon, 12 Jul 2010 07:33:56 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-61695718</link><description>Maybe let's change to different approach, if visual readablity of code matters.&lt;br&gt;&lt;a href="http://github.com/jessemiller/HamlPy" rel="nofollow"&gt;http://github.com/jessemiller/HamlPy&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jan Rzepecki</dc:creator><pubDate>Mon, 12 Jul 2010 06:16:45 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60914845</link><description>If you use spaceless as compression instead of gzip you, my good sir, are a retard. Ta.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Robert Frost</dc:creator><pubDate>Wed, 07 Jul 2010 07:10:36 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60750499</link><description>Yer that sounds like an efficient way to do things, what would be really cool is if the code was minified when &lt;code&gt;DEBUG = False&lt;/code&gt; and tidied when &lt;code&gt;DEBUG = True&lt;/code&gt;.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Tue, 06 Jul 2010 08:09:29 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60750253</link><description>Maybe write a middleware that does post processing to tidy the html.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Harro van der Klauw</dc:creator><pubDate>Tue, 06 Jul 2010 08:06:09 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60707209</link><description>Just make sure your document is not broken. The browser doesn't care about the pretty indentation of your HTML. In fact, you *should* be minifing the most you can, as it's actually a site tuning recommendation, and even factors into Google's pagerank.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Henrique</dc:creator><pubDate>Mon, 05 Jul 2010 22:22:13 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60599613</link><description>I think I'd have to say that this probably lies in the category of problems that either don't really exist or don't need solving. After all, its not really a problem how the HTML looks as there are plenty of ways to view it and thus its not really a problem.&lt;br&gt;&lt;br&gt;Besides, extra indentation hardly makes the HTML unreadable. Not like the output some websites create. Try looking at the output of a .NET site for example.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dougal Matthews</dc:creator><pubDate>Mon, 05 Jul 2010 03:46:46 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60442363</link><description>Jinja2 deals with whitespace (at least partly) by allowing the user to append an - to templatetags: &lt;a href="http://jinja.pocoo.org/2/documentation/templates#whitespace-control" rel="nofollow"&gt;http://jinja.pocoo.org/2/docum...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ericflo</dc:creator><pubDate>Sat, 03 Jul 2010 14:02:47 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60436222</link><description>Right, so you are putting more focus on getting the correct output rather than nicely indented template code?&lt;br&gt;&lt;br&gt;Yes you are quite right about wrapping everything in an if statement in order to create valid HTML - validity is a different matter altogether, and an important one.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Sat, 03 Jul 2010 13:10:34 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60434137</link><description>The first example you show, from the books, makes the most sense.&lt;br&gt;&lt;br&gt;In the UL, when there are items, indent and print them. This is logical.&lt;br&gt;&lt;br&gt;Your example, though, isn't since it automatically introduces a level of indentation regardless of if there are items or not.&lt;br&gt;&lt;br&gt;(really the whole thing should be wrapped in an if anyway to prevent an empty UL)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kenneth Love</dc:creator><pubDate>Sat, 03 Jul 2010 12:49:18 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60422358</link><description>I agree. I think template code is much more important since that is where you (as the developer) are spending most of your time.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Sat, 03 Jul 2010 10:51:04 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60421959</link><description>Django template code should be easy to read. I think thats most importatnt. If you need proper html indentation use &lt;a href="http://djangosnippets.org/snippets/172/" rel="nofollow"&gt;http://djangosnippets.org/snip...&lt;/a&gt; or firebug</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morpho</dc:creator><pubDate>Sat, 03 Jul 2010 10:45:41 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60421492</link><description>If we don't care about the HTML, then we should stop sacrificing the templates indentation for no reason.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Sat, 03 Jul 2010 10:38:21 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60413754</link><description>Who cares ?&lt;br&gt;&lt;br&gt;If the machine read it, it doesn't matter.&lt;br&gt;&lt;br&gt;If a human read it, he will use htmltidy or a firefox extension to get a readable output automatically.&lt;br&gt;&lt;br&gt;It's really not something to waste your time on.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ksamuel</dc:creator><pubDate>Sat, 03 Jul 2010 09:42:51 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60406386</link><description>If it were the case that nobody ever needed to look at the HTML code of a site, we should be just be minifying the whole thing. The fact that we don't (in most cases) suggests that generating legible HTML is somewhat important.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Marcus Whybrow</dc:creator><pubDate>Sat, 03 Jul 2010 07:37:24 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60406086</link><description>ok Nestor, i got your point. i dont have that case very often. but in case i use firebug, edit the parsed dom-tree on-the-fly and copy everything in my django templates. that works best for me.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morpho</dc:creator><pubDate>Sat, 03 Jul 2010 07:33:26 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60405864</link><description>Morpho: looks like we are looking at this from different role perspective.&lt;br&gt;Some times I have been given an already made site (not yet with django) or new part of a site, like say the forums, and have to make it accesible.&lt;br&gt;You are right if the workflow goes like that, but that is not always the case, sadly.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nestor</dc:creator><pubDate>Sat, 03 Jul 2010 07:28:18 -0000</pubDate></item><item><title>Re: What&amp;#8217;s the Deal&amp;nbsp;With: Django&amp;nbsp;Template Indentation</title><link>http://marcuswhybrow.net/django-template-indentation/#comment-60405697</link><description>spaceless doesnt touch javascript. and debugging (firebug, etc) always uses the dom tree, which is already parsed html code. validation and accessibility is a standart. usually we got a final layout first and integrate django template code afterwards.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morpho</dc:creator><pubDate>Sat, 03 Jul 2010 07:23:58 -0000</pubDate></item></channel></rss>
