python - Django post request doing nothing -


so i'm not sure how search had same thing happen them.

i'm working on django website , form won't post database, instead, redirected url containing information in forms, this:

<form id="form">       <input type="hidden" id="compinp" name="compinp">       <input maxlength="20" onkeyup="showpost()" name="title" id="titleinput">                     {{ captcha }} </form> 

where compinp other data gets posted, {{ captcha }} recaptcha checkbox works fine, , when filled in , getting posted, instead of running post function views.py, instead redirected this:

http://localhost:8000/newentry/?compinp=xxxx&title=xxxx&g-recaptcha-response="xxxx-xxxx-xxxx"

it gets posted via jquery through button outside of form, though tried add submit button inside , got exact same thing.

the views.py function handles looks this:

def newentry(request):     if request.method == "get" , request.user.is_authenticated():         #creating objects view, works fine         return render(request, "newentry.html",                       {"champlist": complist, "captcha": captcha})     elif request.method == "post" , request.user.is_authenticated():         captcha = captcha(request.post)         title = request.post.get("title", false)         compname = request.post.get("compinp", false)         comp = comp.objects.get(title=compname)         if captcha.is_valid() , title , compname:             newe= entry_generator(request.user, title, comp)             newe.save()             return redirect('/')         else:             return redirect('/')     else:          handle_home(request.method, request.user) 

this view tries post models app in same project, if makes different.

i had added print attempt @ right after request check post didn't print anything.

not sure other info can give help, if want any, ask (:

you need add form method post:

<form id="form" method="post">   <input type="hidden" id="compinp" name="compinp">   <input maxlength="20" onkeyup="showpost()" name="title" id="titleinput">                 {{ captcha }} </form> 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -