view templates/snippet/explore.html @ 207:d534881629ff

Updated snippet's template and views files to fix rating code collision which prevented posting new snippets. Updated snippet's models file so that now secret id of each snippet will be unique. It also means that the no two or more than two snippets will have same secret id.
author Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
date Mon, 19 Aug 2013 20:30:19 +0500
parents b5e9ad94da00
children
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 "Views" %}</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>{{ snippet.published }}</td>
            <td>{{ snippet.num_views }}</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 %}