Figured it out. I was making a simple mistake using the actual html
file name instead of the incoming url that's mapped to its def. Thank
you for responding so quickly.

On Aug 1, 4:56 pm, Dan Harris <[email protected]> wrote:
> what error are you getting?
>
> On Aug 1, 4:41 pm, cprsystems <[email protected]> wrote:
>
> > I'm trying to write a simple html page using Django that passes one
> > variable via a submit button and text line and prints it out to
> > another hmtl document. I'm having trouble getting it to work. Could
> > someone explain what I'm doing wrong? I've included the code below.
>
> > urls.py
> > # -*- coding: cp1252 -*-
> > from django.conf.urls.defaults import *
> > from dantest.views import *
>
> > # Uncomment the next two lines to enable the admin:
> > # from django.contrib import admin
> > # admin.autodiscover()
>
> > urlpatterns = patterns('',
> >    ('^htmlp1/$', htmlp1),
> >    ('^htmlp2/$', htmlp2),
> > )
>
> > views.py
> > from django.shortcuts import render_to_response
> > import datetime
>
> > def htmlp1(request):
> >     now = datetime.datetime.now()
> >     return render_to_response('page-one.html', locals())
>
> > def htmlp2(request):
> >     student_id = request.GET['student_id']
> >     # if id is 12345 then
> >     # if id is 54321
> >     return render_to_response('page-two.html', locals())
>
> > page-one.html
> > <html>
> > <body>
> > <h1>
> > Please enter your student ID, you hopeless waste of a dorm room
> > </h1>
> > <form action="/htmlp2/" method="get">
> >   <input type="text" name="student_id"/>
> >   <input type="submit" value="Submit">
> > </form>
> > </br>
> > To show how to use variables in the template, the time is {{now}}
> > </body>
> > </html>
>
> > page-two.html
> > <html>
> >     <body>
> >         <h1>You entered id {{student_id}}</h1>
> >     </body>
> > </html>
--~--~---------~--~----~------------~-------~--~----~
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