I have a forms class in forms.py

from django import forms

class ReadSnapForm(forms.Form):
    cycle = forms.CharField(max_length=1)
    message = forms.CharField(widget-forms.Textarea,required=False)

Here is the form that uses the class
{% extends "base.html" %}

<html>
<head>
    <h1>Enter Billing Cycle</h1>
</head>
<body>
        <h1>Enter Billing Cycle</h1>
        {% if form.errors %}
        <p style="color: red;">
            Please correct the error{{ form.errors|pluralize }} below.
        </p>
        {% endif %}

        <form action="" method="post"> {% csrf_token %}
            <table>
                {{ form.as_table }}
            </table>
            <input type="submit" value="Snap Read">
        </form>
</body>
</html>

Here's the code in views.py

from forms import ReadSnapForm

def read_snap(request):
    if request.method == 'POST':
        form = ReadSnapForm(request.POST)
        if form.is_valid():
            cleaned_data = form.cleaned_data
            return HttpResponseRedirect('/read_snap/
after_read_snap.html')
    else:
        form = ReadSnapForm()

    return render_to_response('/read_snap/read_snap.html', {'form':
form})

I can get to the form through an href on a main page, but nothing
displays on the form.

What am I doing wrong?

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

Reply via email to