<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Coverage for pages.templatetags.pages_tags</title>
<link rel='stylesheet' href='style.css' type='text/css'>
<script src='jquery-1.3.2.min.js'></script>
<script>
function toggle_lines(btn, cls) {
    var btn = $(btn);
    if (btn.hasClass("hide")) {
        $("#source ."+cls).removeClass("hide");
        btn.removeClass("hide");
    }
    else {
        $("#source ."+cls).addClass("hide");
        btn.addClass("hide");
    }
}
</script>
</head>
<body>
<div id='header'>
    <div class='content'>
        <h1>Coverage for <b>pages.templatetags.pages_tags</b> :
            <span class='pc_cov'>57%</span>
        </h1>
        <h2 class='stats'>
            171 statements
            <span class='run hide' onclick='toggle_lines(this, "run")'>97 run</span>
            <span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
            <span class='mis' onclick='toggle_lines(this, "mis")'>74 missing</span>
        </h2>
    </div>
</div>

<div id='source'>
<table cellspacing='0' cellpadding='0'>
<tr>
<td class='linenos' valign='top'>
<p class='pln'>1</p>
<p class='stm run hide'>2</p>
<p class='stm run hide'>3</p>
<p class='stm run hide'>4</p>
<p class='stm run hide'>5</p>
<p class='stm run hide'>6</p>
<p class='pln'>7</p>
<p class='stm run hide'>8</p>
<p class='pln'>9</p>
<p class='stm run hide'>10</p>
<p class='stm run hide'>11</p>
<p class='stm run hide'>12</p>
<p class='stm run hide'>13</p>
<p class='stm run hide'>14</p>
<p class='pln'>15</p>
<p class='stm run hide'>16</p>
<p class='pln'>17</p>
<p class='stm run hide'>18</p>
<p class='pln'>19</p>
<p class='stm run hide'>20</p>
<p class='pln'>21</p>
<p class='stm run hide'>22</p>
<p class='stm mis'>23</p>
<p class='pln'>24</p>
<p class='stm run hide'>25</p>
<p class='pln'>26</p>
<p class='stm mis'>27</p>
<p class='stm mis'>28</p>
<p class='stm mis'>29</p>
<p class='stm run hide'>30</p>
<p class='pln'>31</p>
<p class='stm run hide'>32</p>
<p class='pln'>33</p>
<p class='stm run hide'>34</p>
<p class='stm run hide'>35</p>
<p class='pln'>36</p>
<p class='stm mis'>37</p>
<p class='stm mis'>38</p>
<p class='pln'>39</p>
<p class='stm mis'>40</p>
<p class='pln'>41</p>
<p class='stm mis'>42</p>
<p class='stm mis'>43</p>
<p class='pln'>44</p>
<p class='stm mis'>45</p>
<p class='stm mis'>46</p>
<p class='pln'>47</p>
<p class='pln'>48</p>
<p class='pln'>49</p>
<p class='stm run hide'>50</p>
<p class='pln'>51</p>
<p class='pln'>52</p>
<p class='pln'>53</p>
<p class='pln'>54</p>
<p class='pln'>55</p>
<p class='pln'>56</p>
<p class='stm mis'>57</p>
<p class='stm run hide'>58</p>
<p class='pln'>59</p>
<p class='stm run hide'>60</p>
<p class='pln'>61</p>
<p class='pln'>62</p>
<p class='pln'>63</p>
<p class='pln'>64</p>
<p class='pln'>65</p>
<p class='stm mis'>66</p>
<p class='stm run hide'>67</p>
<p class='pln'>68</p>
<p class='pln'>69</p>
<p class='pln'>70</p>
<p class='stm run hide'>71</p>
<p class='pln'>72</p>
<p class='pln'>73</p>
<p class='pln'>74</p>
<p class='pln'>75</p>
<p class='pln'>76</p>
<p class='pln'>77</p>
<p class='stm run hide'>78</p>
<p class='stm run hide'>79</p>
<p class='stm run hide'>80</p>
<p class='stm run hide'>81</p>
<p class='stm run hide'>82</p>
<p class='stm mis'>83</p>
<p class='stm run hide'>84</p>
<p class='stm run hide'>85</p>
<p class='stm run hide'>86</p>
<p class='stm run hide'>87</p>
<p class='pln'>88</p>
<p class='pln'>89</p>
<p class='stm run hide'>90</p>
<p class='pln'>91</p>
<p class='pln'>92</p>
<p class='pln'>93</p>
<p class='pln'>94</p>
<p class='pln'>95</p>
<p class='pln'>96</p>
<p class='pln'>97</p>
<p class='stm run hide'>98</p>
<p class='stm run hide'>99</p>
<p class='stm run hide'>100</p>
<p class='stm run hide'>101</p>
<p class='stm mis'>102</p>
<p class='stm mis'>103</p>
<p class='stm run hide'>104</p>
<p class='stm run hide'>105</p>
<p class='stm run hide'>106</p>
<p class='stm run hide'>107</p>
<p class='pln'>108</p>
<p class='pln'>109</p>
<p class='stm run hide'>110</p>
<p class='pln'>111</p>
<p class='stm mis'>112</p>
<p class='pln'>113</p>
<p class='stm mis'>114</p>
<p class='stm mis'>115</p>
<p class='stm mis'>116</p>
<p class='stm mis'>117</p>
<p class='pln'>118</p>
<p class='stm mis'>119</p>
<p class='stm mis'>120</p>
<p class='pln'>121</p>
<p class='stm mis'>122</p>
<p class='stm mis'>123</p>
<p class='stm mis'>124</p>
<p class='stm mis'>125</p>
<p class='stm mis'>126</p>
<p class='pln'>127</p>
<p class='stm mis'>128</p>
<p class='stm run hide'>129</p>
<p class='pln'>130</p>
<p class='pln'>131</p>
<p class='pln'>132</p>
<p class='stm run hide'>133</p>
<p class='pln'>134</p>
<p class='pln'>135</p>
<p class='pln'>136</p>
<p class='pln'>137</p>
<p class='pln'>138</p>
<p class='pln'>139</p>
<p class='pln'>140</p>
<p class='pln'>141</p>
<p class='pln'>142</p>
<p class='pln'>143</p>
<p class='pln'>144</p>
<p class='pln'>145</p>
<p class='pln'>146</p>
<p class='pln'>147</p>
<p class='pln'>148</p>
<p class='pln'>149</p>
<p class='pln'>150</p>
<p class='pln'>151</p>
<p class='pln'>152</p>
<p class='stm run hide'>153</p>
<p class='pln'>154</p>
<p class='stm run hide'>155</p>
<p class='pln'>156</p>
<p class='pln'>157</p>
<p class='stm run hide'>158</p>
<p class='pln'>159</p>
<p class='stm mis'>160</p>
<p class='stm mis'>161</p>
<p class='pln'>162</p>
<p class='stm mis'>163</p>
<p class='stm mis'>164</p>
<p class='stm mis'>165</p>
<p class='pln'>166</p>
<p class='stm mis'>167</p>
<p class='stm run hide'>168</p>
<p class='pln'>169</p>
<p class='pln'>170</p>
<p class='pln'>171</p>
<p class='stm run hide'>172</p>
<p class='pln'>173</p>
<p class='pln'>174</p>
<p class='pln'>175</p>
<p class='pln'>176</p>
<p class='pln'>177</p>
<p class='pln'>178</p>
<p class='pln'>179</p>
<p class='pln'>180</p>
<p class='pln'>181</p>
<p class='pln'>182</p>
<p class='pln'>183</p>
<p class='pln'>184</p>
<p class='pln'>185</p>
<p class='pln'>186</p>
<p class='stm run hide'>187</p>
<p class='stm run hide'>188</p>
<p class='stm run hide'>189</p>
<p class='stm run hide'>190</p>
<p class='stm run hide'>191</p>
<p class='stm mis'>192</p>
<p class='stm mis'>193</p>
<p class='stm mis'>194</p>
<p class='stm mis'>195</p>
<p class='stm run hide'>196</p>
<p class='pln'>197</p>
<p class='pln'>198</p>
<p class='stm run hide'>199</p>
<p class='pln'>200</p>
<p class='pln'>201</p>
<p class='stm mis'>202</p>
<p class='stm mis'>203</p>
<p class='stm mis'>204</p>
<p class='pln'>205</p>
<p class='stm mis'>206</p>
<p class='stm mis'>207</p>
<p class='stm mis'>208</p>
<p class='stm run hide'>209</p>
<p class='pln'>210</p>
<p class='pln'>211</p>
<p class='stm run hide'>212</p>
<p class='pln'>213</p>
<p class='pln'>214</p>
<p class='pln'>215</p>
<p class='pln'>216</p>
<p class='pln'>217</p>
<p class='pln'>218</p>
<p class='pln'>219</p>
<p class='pln'>220</p>
<p class='pln'>221</p>
<p class='pln'>222</p>
<p class='stm mis'>223</p>
<p class='stm mis'>224</p>
<p class='stm mis'>225</p>
<p class='stm mis'>226</p>
<p class='stm mis'>227</p>
<p class='stm mis'>228</p>
<p class='stm mis'>229</p>
<p class='pln'>230</p>
<p class='pln'>231</p>
<p class='stm mis'>232</p>
<p class='stm mis'>233</p>
<p class='stm mis'>234</p>
<p class='stm run hide'>235</p>
<p class='pln'>236</p>
<p class='pln'>237</p>
<p class='pln'>238</p>
<p class='pln'>239</p>
<p class='stm run hide'>240</p>
<p class='pln'>241</p>
<p class='pln'>242</p>
<p class='pln'>243</p>
<p class='pln'>244</p>
<p class='pln'>245</p>
<p class='pln'>246</p>
<p class='pln'>247</p>
<p class='pln'>248</p>
<p class='pln'>249</p>
<p class='stm run hide'>250</p>
<p class='stm run hide'>251</p>
<p class='stm run hide'>252</p>
<p class='stm run hide'>253</p>
<p class='stm run hide'>254</p>
<p class='stm mis'>255</p>
<p class='stm run hide'>256</p>
<p class='stm run hide'>257</p>
<p class='pln'>258</p>
<p class='pln'>259</p>
<p class='pln'>260</p>
<p class='pln'>261</p>
<p class='pln'>262</p>
<p class='pln'>263</p>
<p class='pln'>264</p>
<p class='stm run hide'>265</p>
<p class='pln'>266</p>
<p class='stm run hide'>267</p>
<p class='stm mis'>268</p>
<p class='stm mis'>269</p>
<p class='stm mis'>270</p>
<p class='stm mis'>271</p>
<p class='stm run hide'>272</p>
<p class='stm mis'>273</p>
<p class='pln'>274</p>
<p class='pln'>275</p>
<p class='pln'>276</p>
<p class='pln'>277</p>
<p class='pln'>278</p>
<p class='stm mis'>279</p>
<p class='pln'>280</p>
<p class='stm run hide'>281</p>
<p class='pln'>282</p>
<p class='pln'>283</p>
<p class='pln'>284</p>
<p class='pln'>285</p>
<p class='pln'>286</p>
<p class='pln'>287</p>
<p class='pln'>288</p>
<p class='pln'>289</p>
<p class='pln'>290</p>
<p class='pln'>291</p>
<p class='pln'>292</p>
<p class='pln'>293</p>
<p class='pln'>294</p>
<p class='pln'>295</p>
<p class='pln'>296</p>
<p class='pln'>297</p>
<p class='pln'>298</p>
<p class='pln'>299</p>
<p class='pln'>300</p>
<p class='stm mis'>301</p>
<p class='stm mis'>302</p>
<p class='stm mis'>303</p>
<p class='stm mis'>304</p>
<p class='stm mis'>305</p>
<p class='pln'>306</p>
<p class='stm mis'>307</p>
<p class='stm mis'>308</p>
<p class='stm mis'>309</p>
<p class='stm mis'>310</p>
<p class='stm mis'>311</p>
<p class='stm mis'>312</p>
<p class='stm mis'>313</p>
<p class='stm run hide'>314</p>
<p class='pln'>315</p>
<p class='pln'>316</p>
<p class='stm run hide'>317</p>
<p class='pln'>318</p>
<p class='stm run hide'>319</p>
<p class='stm run hide'>320</p>
<p class='stm run hide'>321</p>
<p class='stm run hide'>322</p>
<p class='stm run hide'>323</p>
<p class='stm run hide'>324</p>
<p class='stm run hide'>325</p>
<p class='pln'>326</p>
<p class='stm run hide'>327</p>
<p class='pln'>328</p>
<p class='pln'>329</p>
<p class='pln'>330</p>
<p class='pln'>331</p>
<p class='pln'>332</p>
<p class='pln'>333</p>
<p class='pln'>334</p>
<p class='pln'>335</p>
<p class='pln'>336</p>
<p class='pln'>337</p>
<p class='pln'>338</p>
<p class='pln'>339</p>
<p class='stm run hide'>340</p>
<p class='stm run hide'>341</p>
<p class='pln'>342</p>
<p class='pln'>343</p>
<p class='stm run hide'>344</p>
<p class='pln'>345</p>
<p class='pln'>346</p>
<p class='pln'>347</p>
<p class='pln'>348</p>
<p class='pln'>349</p>
<p class='pln'>350</p>
<p class='pln'>351</p>
<p class='pln'>352</p>
<p class='pln'>353</p>
<p class='pln'>354</p>
<p class='pln'>355</p>
<p class='pln'>356</p>
<p class='pln'>357</p>
<p class='pln'>358</p>
<p class='pln'>359</p>
<p class='stm run hide'>360</p>
<p class='stm run hide'>361</p>
<p class='stm run hide'>362</p>
<p class='pln'>363</p>
<p class='pln'>364</p>
<p class='stm run hide'>365</p>
<p class='pln'>366</p>
<p class='pln'>367</p>
<p class='pln'>368</p>
<p class='stm run hide'>369</p>
<p class='stm run hide'>370</p>
<p class='stm run hide'>371</p>
<p class='pln'>372</p>
<p class='stm run hide'>373</p>
<p class='pln'>374</p>
<p class='pln'>375</p>
<p class='pln'>376</p>
<p class='stm run hide'>377</p>
<p class='stm run hide'>378</p>
<p class='stm run hide'>379</p>
<p class='pln'>380</p>
    
</td>
<td class='text' valign='top'>
<p class='pln'># -*- coding: utf-8 -*-</p>
<p class='stm run hide'>&quot;&quot;&quot;Page CMS page_tags template tags&quot;&quot;&quot;</p>
<p class='stm run hide'>from django import template</p>
<p class='stm run hide'>from django.utils.safestring import SafeUnicode, mark_safe</p>
<p class='stm run hide'>from django.utils.translation import ugettext_lazy as _</p>
<p class='stm run hide'>from django.template import Template, TemplateSyntaxError</p>
<p class='pln'>#from django.forms import Widget, Textarea, ImageField, CharField</p>
<p class='stm run hide'>import urllib</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>from pages import settings</p>
<p class='stm run hide'>from pages.models import Content, Page</p>
<p class='stm run hide'>from pages.placeholders import PlaceholderNode, ImagePlaceholderNode</p>
<p class='stm run hide'>from pages.placeholders import VideoPlaceholderNode</p>
<p class='stm run hide'>from pages.placeholders import parse_placeholder</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>register = template.Library()</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>PLACEHOLDER_ERROR = _(&quot;[Placeholder %(name)s had syntax error: %(error)s]&quot;)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def get_page_from_string_or_id(page_string, lang):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Return a Page object from a slug or an id.&quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; if type(page_string) == int:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return Page.objects.get(pk=int(page_string))</p>
<p class='pln'>&nbsp; &nbsp; # if we have a string coming from some templates templates</p>
<p class='stm run hide'>&nbsp; &nbsp; if (isinstance(page_string, SafeUnicode) or</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; isinstance(page_string, unicode)):</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if page_string.isdigit():</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Page.objects.get(pk=int(page_string))</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return Page.objects.from_path(page_string, lang)</p>
<p class='stm run hide'>&nbsp; &nbsp; return page_string</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def _get_content(context, page, content_type, lang, fallback=True):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Helper function used by ``PlaceholderNode``.&quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; if not page:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; if not lang and &#39;lang&#39; in context:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; if not page:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; c = Content.objects.get_content(page, lang, content_type, fallback)</p>
<p class='stm mis'>&nbsp; &nbsp; return c</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&quot;&quot;&quot;Filters&quot;&quot;&quot;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def has_content_in(page, language):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Fitler that return ``True`` if the page has any content in a</p>
<p class='pln'>&nbsp; &nbsp; particular language.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the current page</p>
<p class='pln'>&nbsp; &nbsp; :param language: the language you want to look at</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; return Content.objects.filter(page=page, language=language).count() &gt; 0</p>
<p class='stm run hide'>register.filter(has_content_in)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def has_permission(page, request):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Tell if a user has permissions on the page.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the current page</p>
<p class='pln'>&nbsp; &nbsp; :param request: the request object where the user is extracted</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; return page.has_page_permission(request)</p>
<p class='stm run hide'>register.filter(has_permission)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&quot;&quot;&quot;Inclusion tags&quot;&quot;&quot;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def pages_menu(context, page, url=&#39;/&#39;):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Render a nested list of all the descendents of the given page,</p>
<p class='pln'>&nbsp; &nbsp; including this page.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the page where to start the menu from.</p>
<p class='pln'>&nbsp; &nbsp; :param url: not used anymore.</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm run hide'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm run hide'>&nbsp; &nbsp; path = context.get(&#39;path&#39;, None)</p>
<p class='stm run hide'>&nbsp; &nbsp; site_id = None</p>
<p class='stm run hide'>&nbsp; &nbsp; if page:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; children = page.get_children_for_frontend()</p>
<p class='stm run hide'>&nbsp; &nbsp; if &#39;current_page&#39; in context:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; current_page = context[&#39;current_page&#39;]</p>
<p class='stm run hide'>&nbsp; &nbsp; return locals()</p>
<p class='stm run hide'>pages_menu = register.inclusion_tag(&#39;pages/menu.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(pages_menu)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def pages_sub_menu(context, page, url=&#39;/&#39;):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Get the root page of the given page and</p>
<p class='pln'>&nbsp; &nbsp; render a nested list of all root&#39;s children pages.</p>
<p class='pln'>&nbsp; &nbsp; Good for rendering a secondary menu.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the page where to start the menu from.</p>
<p class='pln'>&nbsp; &nbsp; :param url: not used anymore.</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm run hide'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm run hide'>&nbsp; &nbsp; path = context.get(&#39;path&#39;, None)</p>
<p class='stm run hide'>&nbsp; &nbsp; if page:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; root = page.get_root()</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; children = root.get_children_for_frontend()</p>
<p class='stm run hide'>&nbsp; &nbsp; if &#39;current_page&#39; in context:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; current_page = context[&#39;current_page&#39;]</p>
<p class='stm run hide'>&nbsp; &nbsp; return locals()</p>
<p class='stm run hide'>pages_sub_menu = register.inclusion_tag(&#39;pages/sub_menu.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(pages_sub_menu)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def pages_admin_menu(context, page, url=&#39;&#39;, level=None):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Render the admin table of pages.&quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; request = context[&#39;request&#39;]</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; if &quot;tree_expanded&quot; in request.COOKIES:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; cookie_string = urllib.unquote(request.COOKIES[&#39;tree_expanded&#39;])</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if cookie_string:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ids = [int(id) for id in</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; urllib.unquote(request.COOKIES[&#39;tree_expanded&#39;]).split(&#39;,&#39;)]</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if page.id in ids:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; expanded = True</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; page_languages = settings.PAGE_LANGUAGES</p>
<p class='stm mis'>&nbsp; &nbsp; has_permission = page.has_page_permission(request)</p>
<p class='stm mis'>&nbsp; &nbsp; PAGES_MEDIA_URL = settings.PAGES_MEDIA_URL</p>
<p class='stm mis'>&nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm mis'>&nbsp; &nbsp; LANGUAGE_BIDI = context.get(&#39;LANGUAGE_BIDI&#39;, False)</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; return locals()</p>
<p class='stm run hide'>pages_admin_menu = register.inclusion_tag(&#39;admin/pages/page/menu.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(pages_admin_menu)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def show_content(context, page, content_type, lang=None, fallback=True):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Display a content type from a page.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Example::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% show_content page_object &quot;title&quot; %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; You can also use the slug of a page::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% show_content &quot;my-page-slug&quot; &quot;title&quot; %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Or even the id of a page::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% show_content 10 &quot;title&quot; %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the page object, slug or id</p>
<p class='pln'>&nbsp; &nbsp; :param content_type: content_type used by a placeholder</p>
<p class='pln'>&nbsp; &nbsp; :param lang: the wanted language (default None, use the request object to know)</p>
<p class='pln'>&nbsp; &nbsp; :param fallback: use fallback content from other language</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; return {&#39;content&#39;:_get_content(context, page, content_type, lang,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fallback)}</p>
<p class='stm run hide'>show_content = register.inclusion_tag(&#39;pages/content.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(show_content)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def show_slug_with_level(context, page, lang=None, fallback=True):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Display slug with level by language.&quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; if not lang:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm mis'>&nbsp; &nbsp; if not page:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
<p class='pln'>&nbsp;</p>
<p class='stm mis'>&nbsp; &nbsp; return {&#39;content&#39;: page.slug_with_level(lang)}</p>
<p class='stm run hide'>show_slug_with_level = register.inclusion_tag(&#39;pages/content.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(show_slug_with_level)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def show_absolute_url(context, page, lang=None):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Show the url of a page in the right language</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Example ::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% show_absolute_url page_object %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; You can also use the slug of a page::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% show_absolute_url &quot;my-page-slug&quot; %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Keyword arguments:</p>
<p class='pln'>&nbsp; &nbsp; :param page: the page object, slug or id</p>
<p class='pln'>&nbsp; &nbsp; :param lang: the wanted language (defaults to `settings.PAGE_DEFAULT_LANGUAGE`)</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; if not lang:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm run hide'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm run hide'>&nbsp; &nbsp; if not page:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return {&#39;content&#39;:&#39;&#39;}</p>
<p class='stm mis'>&nbsp; &nbsp; url = page.get_url_path(language=lang)</p>
<p class='stm mis'>&nbsp; &nbsp; if url:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return {&#39;content&#39;:url}</p>
<p class='stm mis'>&nbsp; &nbsp; return {&#39;content&#39;:&#39;&#39;}</p>
<p class='stm run hide'>show_absolute_url = register.inclusion_tag(&#39;pages/content.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(show_absolute_url)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def show_revisions(context, page, content_type, lang=None):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Render the last 10 revisions of a page content with a list using</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; the ``pages/revisions.html`` template&quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; if not settings.PAGE_CONTENT_REVISION:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return {&#39;revisions&#39;:None}</p>
<p class='stm mis'>&nbsp; &nbsp; revisions = Content.objects.filter(page=page, language=lang,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type=content_type).order_by(&#39;-creation_date&#39;)</p>
<p class='stm mis'>&nbsp; &nbsp; if len(revisions) &lt; 2:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return {&#39;revisions&#39;:None}</p>
<p class='stm mis'>&nbsp; &nbsp; return {&#39;revisions&#39;:revisions[0:10]}</p>
<p class='stm run hide'>show_revisions = register.inclusion_tag(&#39;pages/revisions.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; takes_context=True)(show_revisions)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def pages_dynamic_tree_menu(context, page, url=&#39;/&#39;):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='pln'>&nbsp; &nbsp; Render a &quot;dynamic&quot; tree menu, with all nodes expanded which are either</p>
<p class='pln'>&nbsp; &nbsp; ancestors or the current page itself.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Override ``pages/dynamic_tree_menu.html`` if you want to change the</p>
<p class='pln'>&nbsp; &nbsp; design.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the current page</p>
<p class='pln'>&nbsp; &nbsp; :param url: not used anymore</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm mis'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm mis'>&nbsp; &nbsp; request = context[&#39;request&#39;]</p>
<p class='stm mis'>&nbsp; &nbsp; site_id = None</p>
<p class='stm mis'>&nbsp; &nbsp; children = None</p>
<p class='stm mis'>&nbsp; &nbsp; if &#39;current_page&#39; in context:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; current_page = context[&#39;current_page&#39;]</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # if this node is expanded, we also have to render its children</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # a node is expanded if it is the current node or one of its ancestors</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if page.lft &lt;= current_page.lft and page.rght &gt;= current_page.rght:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; children = page.get_children_for_frontend()</p>
<p class='stm mis'>&nbsp; &nbsp; return locals()</p>
<p class='stm run hide'>pages_dynamic_tree_menu = register.inclusion_tag(</p>
<p class='pln'>&nbsp; &nbsp; &#39;pages/dynamic_tree_menu.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; takes_context=True</p>
<p class='pln'>)(pages_dynamic_tree_menu)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def pages_breadcrumb(context, page, url=&#39;/&#39;):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='pln'>&nbsp; &nbsp; Render a breadcrumb like menu.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Override ``pages/breadcrumb.html`` if you want to change the</p>
<p class='pln'>&nbsp; &nbsp; design.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the current page</p>
<p class='pln'>&nbsp; &nbsp; :param url: not used anymore</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; lang = context.get(&#39;lang&#39;, settings.PAGE_DEFAULT_LANGUAGE)</p>
<p class='stm run hide'>&nbsp; &nbsp; page = get_page_from_string_or_id(page, lang)</p>
<p class='stm run hide'>&nbsp; &nbsp; request = context[&#39;request&#39;]</p>
<p class='stm run hide'>&nbsp; &nbsp; site_id = None</p>
<p class='stm run hide'>&nbsp; &nbsp; if page:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; pages_navigation = page.get_ancestors()</p>
<p class='stm run hide'>&nbsp; &nbsp; return locals()</p>
<p class='stm run hide'>pages_breadcrumb = register.inclusion_tag(</p>
<p class='pln'>&nbsp; &nbsp; &#39;pages/breadcrumb.html&#39;,</p>
<p class='pln'>&nbsp; &nbsp; takes_context=True</p>
<p class='pln'>)(pages_breadcrumb)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&quot;&quot;&quot;Tags&quot;&quot;&quot;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>class GetContentNode(template.Node):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Get content node&quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; def __init__(self, page, content_type, varname, lang):</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.page = page</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.content_type = content_type</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.varname = varname</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.lang = lang</p>
<p class='stm run hide'>&nbsp; &nbsp; def render(self, context):</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; context[self.varname] = _get_content(</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context,</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.page.resolve(context),</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.content_type.resolve(context),</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.lang</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; )</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def do_get_content(parser, token):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Store a content type from a page into a context variable.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Example::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% get_content page_object &quot;title&quot; as content %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; You can also use the slug of a page::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% get_content &quot;my-page-slug&quot; &quot;title&quot; as content %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Syntax::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% get_content page type [lang] as name %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; :param page: the page object, slug or id</p>
<p class='pln'>&nbsp; &nbsp; :param type: content_type used by a placeholder</p>
<p class='pln'>&nbsp; &nbsp; :param name: name of the context variable to store the content in</p>
<p class='pln'>&nbsp; &nbsp; :param lang: the wanted language</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm mis'>&nbsp; &nbsp; bits = token.split_contents()</p>
<p class='stm mis'>&nbsp; &nbsp; if not 5 &lt;= len(bits) &lt;= 6:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; raise TemplateSyntaxError(&#39;%r expects 4 or 5 arguments&#39; % bits[0])</p>
<p class='stm mis'>&nbsp; &nbsp; if bits[-2] != &#39;as&#39;:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; raise TemplateSyntaxError(</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;%r expects &quot;as&quot; as the second last argument&#39; % bits[0])</p>
<p class='stm mis'>&nbsp; &nbsp; page = parser.compile_filter(bits[1])</p>
<p class='stm mis'>&nbsp; &nbsp; content_type = parser.compile_filter(bits[2])</p>
<p class='stm mis'>&nbsp; &nbsp; varname = bits[-1]</p>
<p class='stm mis'>&nbsp; &nbsp; lang = None</p>
<p class='stm mis'>&nbsp; &nbsp; if len(bits) == 6:</p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; lang = parser.compile_filter(bits[3])</p>
<p class='stm mis'>&nbsp; &nbsp; return GetContentNode(page, content_type, varname, lang)</p>
<p class='stm run hide'>do_get_content = register.tag(&#39;get_content&#39;, do_get_content)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>class LoadPagesNode(template.Node):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Load page node.&quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; def render(self, context):</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if &#39;pages_navigation&#39; not in context:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pages = Page.objects.navigation().order_by(&quot;tree_id&quot;)</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.update({&#39;pages_navigation&#39;: pages})</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if &#39;current_page&#39; not in context:</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.update({&#39;current_page&#39;:None})</p>
<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def do_load_pages(parser, token):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Load the navigation pages, lang, and current_page variables into the</p>
<p class='pln'>&nbsp; &nbsp; current context.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Example::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% load_pages %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% for page in pages_navigation %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% pages_menu page %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {% endfor %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; return LoadPagesNode()</p>
<p class='stm run hide'>do_load_pages = register.tag(&#39;load_pages&#39;, do_load_pages)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def do_placeholder(parser, token):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='pln'>&nbsp; &nbsp; Method that parse the placeholder template tag.</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Syntax::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% placeholder &lt;name&gt; [on &lt;page&gt;] [with &lt;widget&gt;] \</p>
<p class='pln'>[parsed] [as &lt;varname&gt;] %}</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; Example usage::</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% placeholder about %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% placeholder body with TextArea as body_text %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% placeholder welcome with TextArea parsed as welcome_text %}</p>
<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; {% placeholder teaser on next_page with TextArea parsed %}</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; name, params = parse_placeholder(parser, token)</p>
<p class='stm run hide'>&nbsp; &nbsp; return PlaceholderNode(name, **params)</p>
<p class='stm run hide'>register.tag(&#39;placeholder&#39;, do_placeholder)</p>
<p class='pln'>&nbsp;</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def do_imageplaceholder(parser, token):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='pln'>&nbsp; &nbsp; Method that parse the imageplaceholder template tag.</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; name, params = parse_placeholder(parser, token)</p>
<p class='stm run hide'>&nbsp; &nbsp; return ImagePlaceholderNode(name, **params)</p>
<p class='stm run hide'>register.tag(&#39;imageplaceholder&#39;, do_imageplaceholder)</p>
<p class='pln'>&nbsp;</p>
<p class='stm run hide'>def do_videoplaceholder(parser, token):</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='pln'>&nbsp; &nbsp; Method that parse the imageplaceholder template tag.</p>
<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
<p class='stm run hide'>&nbsp; &nbsp; name, params = parse_placeholder(parser, token)</p>
<p class='stm run hide'>&nbsp; &nbsp; return VideoPlaceholderNode(name, **params)</p>
<p class='stm run hide'>register.tag(&#39;videoplaceholder&#39;, do_videoplaceholder)</p>
<p class='pln'>&nbsp;</p>
    
</td>
</tr>
</table>
</div>

</body>
</html>
