Django form won't display

Rambo_pang43200

New Member
I'm working on a project and we need to add a form to add an event. It lists the name, date, time, and address. I got the form to work but when I added the base, the form doesn't show up on the web page with the base loaded. I'm thinking it has something to do with my html file. Here is my html file.\[code\]{% extends "base.html" %}{% block heading %}My Events{% endblock %}{% block content3 %} </h1><b><font size="5">Save Event</b></h1></font> <form method="POST" action=".">{% csrf_token %} {{form.as_p}} <input type ="submit" value="http://stackoverflow.com/questions/13809979/Add Event"/> </form>{% endblock %}\[/code\]views:\[code\]def add_event(request): user = request.user events = user.event_set.all() if request.method == "POST": form = EventForm(request.POST) if form.is_valid(): event = Event.objects.create( eventname = form.cleaned_data['eventname'], eventdate = form.cleaned_data['eventdate'], eventtime = form.cleaned_data['eventtime'], address = form.cleaned_data['address'], user = request.user ) return HttpResponseRedirect('/') else: form = EventForm() variables = RequestContext(request, { 'form': form }) return render_to_response('add_event.html',variables)\[/code\]base:\[code\]HTML (base.html)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title>DelMarVa Happenings | {% block title %}{% endblock %}</title> <link rel="stylesheet" href="http://stackoverflow.com/site_media/style.css" type="text/css" /></head><body> <div id="wrapper"> <div id="masthead"> <div id="logo"> <img src="http://stackoverflow.com/site_media/Delmarva.gif" width="100px" height="80px" /> </div> <h1>DelMarVa Happenings</h1> <br /> <h4>A listing of events in and around Delaware, Maryland, and Virginia</h4> </div> <div id="nav"> {% if user.is_authenticated %} <h3>welcome, {{ user.username }}</h3> {% else %} <h3>welcome, guest</h3> {% endif %} <ul> <li><a href="http://stackoverflow.com/">home<a/></li> {% if user.is_authenticated %} <li><a href="http://stackoverflow.com/event/">add event</a></li> <li><a href="http://stackoverflow.com/user/">my events</a></li> <li><a href="http://stackoverflow.com/account/">my account</a></li> <li><a href="http://stackoverflow.com/logout/">logout</a></li> {% else %} <li><a href="http://stackoverflow.com/login/">login</a></li> <li><a href="http://stackoverflow.com/register/">register</a></li> {% endif %} </ul> </div> <div id="ads"> <img src="http://stackoverflow.com/site_media/ad.jpg" /> </div> <div id="main"> <h2>{% block head %}{% endblock %}</h2> {% block content %}{% endblock %} </div> </div></body></html>\[/code\]
 
Back
Top