Django-Tutorials
Django-Tutorials copied to clipboard
didn't return an HttpResponse object. It returned None instead
Hi Guys, I see that this issue has been resolved. But in my case is still bugging me. This is my code, could someone check it and see what i'am doing wrong please? Here is my code:
@login_required def add_comment_to_post(request,pk): post = get_object_or_404(Post,pk=pk) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) # post is the pk in the model comment comment.post = post comment.save() return redirect('blog:post_detail', pk=post.pk) else: form = CommentForm() return render(request,'blog/comment_form.html',{'form':form})
I use django form 3 month, and from now a days.. Whenever I gonna start a project it gives me an error... " Django is not recognized" And for that problem , i can't start a single project from 1 week,
But I can run my previous projects .Which I have done earlier Help me sir,, i am not able to continue my practice for this problem...
Thank you in advance ... Sir
On Fri, 18 Jan 2019, 16:01 Misterlae81, [email protected] wrote:
Hi Guys, I see that this issue has been resolved. But in my case is still bugging me. This is my code, could someone check it and see what i'am doing wrong please? Here is my code:
def add_comment_to_post(request,pk): post = get_object_or_404(Post,pk=pk) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False)
post is the pk in the model comment
comment.post = post comment.save() return redirect('blog:post_detail', pk=post.pk) else: form = CommentForm() return render(request,'blog/comment_form.html',{'form':form})
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maxg203/Django-Tutorials/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/ApkMChlauAXi2-A0RcH8pIX8_GWMUuMtks5vEaKcgaJpZM4aHpCo .
Hi Sir, Can you send me your the structure of your code that you having the issu? To look at it. I’am as well a novice in Django but maybe i can help.
Best regards | Cordialement | Sincero |Met Vriendelijk | Mesi
On 21 Jan 2019, at 11:56, Ankush Banik <[email protected]mailto:[email protected]> wrote:
I use django form 3 month, and from now a days.. Whenever I gonna start a project it gives me an error... " Django is not recognized" And for that problem , i can't start a single project from 1 week,
But I can run my previous projects .Which I have done earlier Help me sir,, i am not able to continue my practice for this problem...
Thank you in advance ... Sir
On Fri, 18 Jan 2019, 16:01 Misterlae81, <[email protected]mailto:[email protected]> wrote:
Hi Guys, I see that this issue has been resolved. But in my case is still bugging me. This is my code, could someone check it and see what i'am doing wrong please? Here is my code:
def add_comment_to_post(request,pk): post = get_object_or_404(Post,pk=pk) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False)
post is the pk in the model comment
comment.post = post comment.save() return redirect('blog:post_detail', pk=post.pk) else: form = CommentForm() return render(request,'blog/comment_form.html',{'form':form})
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maxg203/Django-Tutorials/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/ApkMChlauAXi2-A0RcH8pIX8_GWMUuMtks5vEaKcgaJpZM4aHpCo .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/maxg203/Django-Tutorials/issues/13#issuecomment-456032909, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ArUNW3qgIHHIIJAPURRK4ROD7YwbrF9xks5vFZzygaJpZM4aHpCo.