Hi, I've only started to study the Python and web-programming as well.
I need to code a simple web-application with several pages to switch
between, but I don't know a proper way to redirect. How it could be
done using the Django?
Here is my code, wich doesn't work proper

views.py

from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse

def main(request):
    t = get_template('main.html')
    html = t.render(Context())
    return HttpResponse(html)

def gallery(request):
    t = get_template('gallery.html')
    html = t.render(Context())
    return HttpResponse(html)

def about(request):
    t = get_template('about.html')
    html = t.render(Context())
    return HttpResponse(html)



urls.py

from django.conf.urls.defaults import patterns, include, url
from sample2_app.views import *

urlpatterns = patterns('',
     url(r'^main.html/$','sample2_app.views.main'),
     url(r'^gallery.html/$','sample2_app.views.gallery'),
     url(r'^about.html/$','sample2_app.views.about'),
)



Each html page contain this

<ul id="menu-nav">
           <li class="nav-item"><a href="main.html">Main</a></li>
           <li class="nav-item"><a href="gallery.html">Gallery</a></
li>
           <li class="nav-item"><a href="about.html">About</a></li>
  </ul>


Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to