﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16977	CommentForm Issue	philippe@…	nobody	"I'm having some troubles getting a commentform view working on django 1.3. It could be a bug

Here's the deal:

I want to create a class based View that displays a page with a comment form.

So I started to create a view like this

{{{
from django.views.generic import FormView
from django.contrib.comments.forms import CommentForm

class MyView(FormView):
    template_name=""my_template.html""
    form_class=CommentForm

}}}

The problem is I'm getting a 500 Error when the view treats the post data. The error tells me that Commentform takes no 'FILES' as parameter. I didn't understand so I started digging in django code and found this :

{{{
 class FormMixin(object):

    ...

    def get_form_kwargs(self):
        """"""
        Returns the keyword arguments for instanciating the form.
        """"""
        kwargs = {'initial': self.get_initial()}
        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        return kwargs

}}}

Then I also found this:

{{{
class CommentSecurityForm(forms.Form):
    def __init__(self, target_object, data=None, initial=None):
        self.target_object = target_object
        if initial is None:
            initial = {}
        initial.update(self.generate_security_data())
        super(CommentSecurityForm, self).__init__(data=data, initial=initial)
}}}
As you can see, The Formview transmits 'files' to the form but Commentform has no 'files' in the init method...

Is this a bug in the django code or am I using Formview and Commentform in a total wrong way?

Thanks a lot in advance.
"	Bug	closed	contrib.comments	1.3	Normal	wontfix			Accepted	0	0	0	0	0	0
