add RequestContext to all main views; add logged in status in footer

This commit is contained in:
Sanj 2011-07-04 18:53:18 +05:30
parent 751f9cac45
commit 210c439a0e
3 changed files with 29 additions and 11 deletions

View File

@ -65,11 +65,13 @@ def getFolderList():
full_dirs.sort(key=lambda x: getmtime(x), reverse=True)
return map(lambda x: (basename(x), basename(x)), full_dirs)
@login_required
def upload_files(request):
return render_to_response("upload_files.html", {
context = RequestContext(request, {
'categoryForm': CategoryForm()
})
return render_to_response("upload_files.html", context)
@login_required
def add_category(request):

View File

@ -3,32 +3,41 @@ from django.shortcuts import render_to_response
import Image
import sys
from django.http import HttpResponse
from django.template import RequestContext
def home(request):
return render_to_response("main/home.html")
context = RequestContext(request, {})
return render_to_response("main/home.html", context)
def contact(request):
return render_to_response("main/contact.html")
context = RequestContext(request, {})
return render_to_response("main/contact.html", context)
def archive(request):
return render_to_response("main/archive.html")
context = RequestContext(request, {})
return render_to_response("main/archive.html", context)
def publish(request):
return render_to_response("main/publish.html")
context = RequestContext(request, {})
return render_to_response("main/publish.html", context)
def browse(request):
return render_to_response("main/browse.html")
context = RequestContext(request, {})
return render_to_response("main/browse.html", context)
def faq(request):
return render_to_response("main/faq.html")
context = RequestContext(request, {})
return render_to_response("main/faq.html", context)
def help(request):
return render_to_response("main/help.html")
context = RequestContext(request, {})
return render_to_response("main/help.html", context)
def debug(request):
imageVersion = Image.VERSION
sysPath = ",".join(sys.path)
return HttpResponse(imageVersion + "\n" + sysPath)
# imageVersion = Image.VERSION
# sysPath = ",".join(sys.path)
# return HttpResponse(imageVersion + "\n" + sysPath)
return Foo()
def error(request):
return FooBar()

View File

@ -57,6 +57,13 @@
</ul>
<div id="loginStatus">
{% if user.is_authenticated %}
Logged in as {{ user.username }}.
{% else %}
Not logged in.
{% endif %}
</div>
</div>
<div id="logo">
<a href="http://www.serpentinegallery.org/edgware_road_project.html" title="Serpentine Gallery Webpage">Serpentine <br />Gallery</a>