Hi

I am using the following:

class CreateComment(ListView):
model = Comment
paginate_by = 2
form_class = CommentForm

def post(self, request, *args, **kwargs):
if not request.user.is_authenticated():
return HttpResponseForbidden()

self.object = self.get_object()
self.object.creator = request.user
self.object.object_id = self.kwargs['pk']
self.object.content_type_id = self.kwargs['ct']
self.object.save()
return self.get(request, *args, **kwargs)

def get_queryset(self):
comments = Comment.objects.filter(
object_id=self.kwargs['pk'], content_type_id=self.kwargs['ct']
)
return comments

def get_context_data(self, **kwargs):
context = super(CreateComment, self).get_context_data(**kwargs)
context['form'] = CommentForm
return context

When I try this I get an error stating that there is no attribute 
'get_object'.

Is there a better way to process a form that is in a ListView?

Thank you for any assistance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e1b4630-351a-449e-a288-e8d136bc21ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to