Mercurial > agora-palash
view templates/snippet/explore.html @ 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 | f872c643b056 |
children | b5e9ad94da00 |
line wrap: on
line source
{% extends "snippet/base.djhtml" %} {% load i18n %} {% block title %} Explore {% endblock %} {% block content %} <h2>{% trans "Recent snippets" %}</h2> {% if recent_snippets %} <table class="default"> <thead> <tr> <th>{% trans "Snippet title" %}</th> <th>{% trans "Language" %}</th> <th>{% trans "Created on" %}</th> <th>{% trans "User" %}</th> </tr> </thead> <tbody> {% for snippet in recent_snippets %} <tr> <td><a href="{{ snippet.get_absolute_url }}"> {{ snippet.get_title }} </a></td> <td>{{ snippet.get_lexer_display }} <td>N/A</td> <td> <a href="{{ snippet.author.get_absolute_url }}"> {{ snippet.author }} </a> </td> </tr> </tbody> {% endfor %} </table> {% else %} <p>{% trans "No snippets have been created yet!" %}</p> {% endif %} {% endblock %}