diff templates/snippet/snippet_new.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 8aa8c6dd2b02
children
line wrap: on
line diff
--- a/templates/snippet/snippet_new.djhtml	Sat Sep 29 18:03:35 2012 -0400
+++ b/templates/snippet/snippet_new.djhtml	Sat Sep 29 21:31:17 2012 -0400
@@ -6,7 +6,7 @@
 {% block content %}
     <div id="non-sidebar">
         <h1>{% trans "Paste a new snippet" %}</h1>
-        <p class="hint">{% trans "Snippets provide a way to quickly share pieces of code, complete with line-numbering and syntax-highlighting." %} {% if not user.is_authenticated %}{% trans "Although registration is not required, only registered users can delete their own snippets after ending a session or have them linked to their profile." %}{% endif %}</p>
+        <p class="hint">{% trans "Snippets provide a way to quickly share pieces of code, complete with line-numbering and syntax-highlighting." %} {% if not user.is_authenticated %}{% trans "Although registration is not required, only registered users can delete their own snippets after ending a session or have them linked to their profile. Additionally, snippets made by guests will not be publicly listed." %}{% endif %}</p>
         {% include "snippet/snippet_form.djhtml" %}
     </div><div id="sidebar">
         <h2>Recent snippets</h2>
@@ -18,13 +18,9 @@
             </a>
             <br />
             by
-            {% if snippet.author %}
-                <a href="{{ snippet.author.get_absolute_url }}">
-                    {{ snippet.author }}
-                </a>
-            {% else %}
-            anonymous
-            {% endif %}
+            <a href="{{ snippet.author.get_absolute_url }}">
+                {{ snippet.author }}
+            </a>
         </p>
         {% endfor %}
         <p class="right-float"><a href="{% url snippet_explore %}">