def post(self,request,*args,**kwargs): form = BlogContentForm(request.POST) if not form.is_valid(): raise return self.render_to_response({'form':form})
def post(self,request,*args,**kwargs): form = BlogContentForm(request.POST) if not form.is_valid(): raise obj = form.save(commit=False) obj.created_at,obj.updated_at = [datetime.now()] * 2 obj.save() return HttpResponseRedirect(reverse('blog_index'))
def post(self,request,*args,**kwargs): print 'aaaaaaa' print kwargs blog_id = int(kwargs.get('blog_id'),0) #reply_to = int(kwargs.get('reply_to'),0) if blog_id is None: pass form = BlogContentForm(request.POST) if not form.is_valid(): return HttpResponseRedirect(reverse('blog_index')) obj = form.save(commit=False) #if reply_to: # obj.reply_to = reply_to obj.blog = Blog.objects.get(id=blog_id) obj.save() return HttpResponseRedirect(reverse('blog_detail',args=[blog_id]))