Re: ListView CBV and a form

2015-04-24 Thread felix
El 24/04/15 06:08, David escribió: 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): f

Re: ListView CBV and a form

2015-04-24 Thread David
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)

ListView CBV and a form

2015-04-24 Thread David
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.use