This appears to work. Using a view for 2 functions seems pretty fugly though. Are there better ways to achieve this?
class CreateComment(ListView, FormMixin): model = Comment paginate_by = 2 form_class = CommentForm def post(self, request, *args, **kwargs): form = CommentForm(self.request.POST) if form.is_valid(): obj = form.save(commit=False) obj.creator = request.user obj.object_id = self.kwargs['pk'] obj.content_type_id = self.kwargs['ct'] obj.save() else: return super(CreateComment, self).post(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 -- 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/dafda13d-6171-43ed-97b7-04c229e9dfbf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.