And to be complete:

    from django.http.response import HttpResponseNotAllowed
    # in create
    else:
        return HttpResponseNotAllowed(['get', 'post'])

On Tue, Sep 12, 2017 at 2:08 AM, Luis Zárate <luisz...@gmail.com> wrote:
> if request.method == "GET":
> if request.method == "POST":
>
> Uppercase is needed.
>
> 2017-09-11 17:36 GMT-06:00 harsh sharma <harshsharma199...@gmail.com>:
>>
>>  here i m learning django and i m stuck on one thing
>> the web page returning
>>
>> The view blog.views.create didn't return an HttpResponse object. It
>> returned None instead.
>>
>>
>>
>> and here is my views.py  file
>>
>>
>>
>> def home(request):
>>
>>     story = Story.objects.all()
>>     return render_to_response('show.html',{'story':story})
>>
>>
>>
>>
>> def create(request):
>>     if request.method == "get":
>>         form = storyform()
>>         return render(request,'form.html',{'form':form})
>>     elif request.method == "post":
>>         form= storyform(request.POST)
>>         form.save()
>>         return HttpResponseRedirect('/home')
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/067af0b0-6761-4daf-a1c0-02fcd1585048%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG%2B5VyMqn-Z%3Das%3DYxf_oph5yvDfUi%2BZWU1Uf_554fOTC2y3rsA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Melvyn Sopacua

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Bgw1GUx-0panGx-KCmJ8Q8v0M_%3DU5FN3grp6iUtZXQnLGoF3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to