comparison templates/code.djhtml @ 139:b8e0bdc37e32

Hide snippets created by anonymous users Created a custom manager for Snippet, with a public() method for easily retrieving all the snippets that were created by registered users. This change makes the code a bit neater, as it's no longer to necessary to have to do the {% if snippet.author %} check every time.
author dellsystem <ilostwaldo@gmail.com>
date Sat, 29 Sep 2012 21:31:17 -0400
parents 2bca07be6e51
children c7be7def8b57
comparison
equal deleted inserted replaced
138:4d358e1e3014 139:b8e0bdc37e32
22 <li> 22 <li>
23 <a href="{{ snippet.get_absolute_url }}"> 23 <a href="{{ snippet.get_absolute_url }}">
24 <strong>{{ snippet.get_title }}</strong> 24 <strong>{{ snippet.get_title }}</strong>
25 </a> 25 </a>
26 by 26 by
27 {% if snippet.author %}
28 <a href="{{ snippet.author.get_absolute_url }}"> 27 <a href="{{ snippet.author.get_absolute_url }}">
29 {{ snippet.author }} 28 {{ snippet.author }}
30 </a> 29 </a>
31 {% else %}
32 anonymous
33 {% endif %}
34 <br /> 30 <br />
35 {{ snippet.published }} 31 {{ snippet.published }}
36 </li> 32 </li>
37 {% endfor %} 33 {% endfor %}
38 </ul> 34 </ul>