Feed on
Posts
Comments

Hobo with a Shotgun (2011)

Hangover (2011)

Limitless (2011)

I am number four (2011)

Sucker Punch (2011)

Paul (2011)

def display_meta(request):
    values = request.META.items()
    values.sort()
    html = []
    for k, v in values:
        html.append('%s %s' % (k, v))
    return HttpResponse('%s' % '\n'.join(html))

As an exercise, see whether you can convert this view to use Django’s template system
instead of hard-coding the HTML. Also try adding request.path and the other HttpRequest
methods from the previous section.

Решение

meta.html

{% block content %}
{% for k, v in values %}
<table>
<tbody>
<tr>
<td width="400px">{{ k }}</td>
<td>{{ v }}</td>
</tr>
</tbody>
</table>
{% endfor %}
{% endblock %}

views.py

from django.shortcuts import render_to_response
 
def display_meta(request):
	return render_to_response('meta.html', {'values': sorted(request.META.items())})

Апгрэйд убунту

The simpliest way

Alt+F2

update-manager -d

Не работают дополнительные языки в Squirrelmail

нужно добавить locales
dpkg-reconfigure locales

и

reboot

Older Posts »