Django 1.2 - Pb with a form in a template (WSGIRequest)
- by Tom
Hi, I'm trying to display a form on a template, but I get a fantastic error :
  Caught AttributeError while rendering: 'WSGIRequest' object has no attribute 'get'
The error is in this line : {% for field in form.visible_fields %}
My view :
def view_discussion(request, discussion_id):
 discussion = get_object_or_404(Discussion, id=discussion_id)
 form = BaseMessageForm(request)
 return render(request,'ulule/discussions/view_discussion.html', {
  'discussion':discussion,
  'form':form,
 })
My form :
class BaseMessageForm(forms.Form):
 message_content = forms.CharField(widget=forms.HiddenInput())
My template : 
<form action="" method="post">
{% csrf_token %}
    {% for field in form.visible_fields %}
        <div class="fieldWrapper">
            {% if forloop.first %}
                {% for hidden in form.hidden_fields %}
                {{ hidden }}
                {% endfor %}
            {% endif %}
            {{ field.errors }}
            {{ field.label_tag }}: {{ field }}
        </div>
    {% endfor %}
    <p><input type="submit" value="Send message" /></p>
</form>
Thanks a lot for your help !