python - sqlite django querying database -
i have set query-able database using django 1.8 , sqlite. cannot seem figure out how output when query database. have 2 html files- input.html (with text box , submit button insert data query sqlite database) , output.html (which return according data database). referencing these files , calling output , input functions follows:
the 'views' files input , output in separate directories.
input within /freezer/views.py
def table(request): form=personid() context={ "form": form, } if form.is_valid(): form.save() context={ "title": "thank you" } return render (request, "temp.html", context)
output within /mysite/views.py
def results(request): louis=person.objects.get('louis') context={ 'louis': louis } return render (request, "output.html", context)
models.py contains class "person" fields "firstname" , "lastname", 'louis' , 'pasteur' input these fields sqlite. prefer able input first name , return accompanying last name opposed have above.
furthermore in actual html files have:
input.html
<form id="herv" method="post" action="#######">{% csrf_token %} <th>sequence input</th> <textarea id=�textareainput� name =�textareainput� rows=10 cols=50> input sequence here </textarea> <tr> <input name="confirm" type="submit" onclick ="clicked(event);" value="confirm"> </tr> {{title}} # print 'thank you' </form>
what set action equal in order query database , go output page after printing "thank you"? should process involve modification of "submit" button?
as output.html, simply:
<html> {{louis}} </html>
so overall questions are:
how set system such can query 1 field retrieve corresponding row (should involve 'httpredirect' command)?
can keep views.py's in separate directories long reference paths in 'urls.py' properly?
what set 'action=' in order query database given input?
Comments
Post a Comment