Последняя статья



Вы не вошли в кабинет

Тестирование ошибки

Дата: 24 октября 2015 г. 23:13
Автор: Автор
Перейти посмотреть...


Ваш IP адрес: 54.205.179.155

Модуль views.py

# coding: utf-8
from context.models import PressRelease
from django.shortcuts import render_to_response
from django.template import RequestContext

def latest(request):
    p = PressRelease.objects.latest()
    return render_to_response('latest1.html',
                              {'press': p},
                              context_instance=RequestContext(request))

Шаблон latest1.html

{% extends 'base.html' %}
{% block content %}
<hr>
{% if user.is_anonymous %}
Вы не вошли в кабинет
{% else %}
Вы вошли как: {{ user.email }}
{% endif %}
<hr>
<h1>{{ press.title }}</h1>
<p>
    Дата: {{ press.pub_date }}<br>
    Автор: {{ press.author }}<br>
    <a href="{{ press.get_absolute_url }}">Перейти посмотреть...</a><br>
</p>
</h1>
<hr>
Ваш IP адрес: {{ my_ip_address }}<hr>
{% endblock %}

blog comments powered by Disqus