Re: cicking to menu in navebar leads another subpage /subpage
Products On Mon, 8 Jul 2019 at 22:25, Jani Tiainen wrote: > Hi. > > There are two things wrong. > > First and most important is that you should always use {%url %} template > tag to form urls to other django urls and preferably by using named url > patterns. > > Secondly your hardcoded urls are relative. So each time you click link it > is appended to current url. If you would have been using url-tag you even > wouldn't have this problem. > > ma 8. heinäk. 2019 klo 18.51 Surya Adhikari > kirjoitti: > >> i have a menu bar as, HOME GALLERY >> When i click Home its the index page which is being display after when i >> click Gallary dropdown menu as house it redirects to search.html . BUT >> when i again click hotel it redirects to 127.0.0.1/search/ search1 >> insted of 127.0.0.1/search1. >> >> >> >> i have 3 web pages as: search.html, search1.html, search2.html. i am >> inheriting search.html to all of those HTML file. >> >> My code: >> >> >> >> >> >> Home >> >> >> Gallary >> >> >> >>house >> hotel >> hospital >> >> >> >> -- >> 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/b9c81c3c-30e0-4b3c-84cc-5316ac408089%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/b9c81c3c-30e0-4b3c-84cc-5316ac408089%40googlegroups.com?utm_medium=email_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAHn91ocs4%2BSPnYpAA0w29d8rXv8-OVuw%3DLxAs-D_o-ErP%3DxAFw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAHn91ocs4%2BSPnYpAA0w29d8rXv8-OVuw%3DLxAs-D_o-ErP%3DxAFw%40mail.gmail.com?utm_medium=email_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAM8afuJH7Yfhn3WfT-e4b%2BxCnLWkeDiWB2HUmEwYorkZe1MypA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: cicking to menu in navebar leads another subpage /subpage
Home like this also it is not working can you please exaplin me where and how should i use {% url %} On Monday, 8 July 2019 22:26:07 UTC+5:45, Jani Tiainen wrote: > > Hi. > > There are two things wrong. > > First and most important is that you should always use {%url %} template > tag to form urls to other django urls and preferably by using named url > patterns. > > Secondly your hardcoded urls are relative. So each time you click link it > is appended to current url. If you would have been using url-tag you even > wouldn't have this problem. > > ma 8. heinäk. 2019 klo 18.51 Surya Adhikari > kirjoitti: > >> i have a menu bar as, HOME GALLERY >> When i click Home its the index page which is being display after when i >> click Gallary dropdown menu as house it redirects to search.html . BUT >> when i again click hotel it redirects to 127.0.0.1/search/ search1 >> insted of 127.0.0.1/search1. >> >> >> >> i have 3 web pages as: search.html, search1.html, search2.html. i am >> inheriting search.html to all of those HTML file. >> >> My code: >> >> >> >> >> >> Home >> >> >> Gallary >> >> >> >>house >> hotel >> hospital >> >> >> >> -- >> 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...@googlegroups.com . >> To post to this group, send email to django...@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/b9c81c3c-30e0-4b3c-84cc-5316ac408089%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/b9c81c3c-30e0-4b3c-84cc-5316ac408089%40googlegroups.com?utm_medium=email_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/f1687106-1103-4de8-9e0f-8721054bedd6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
cicking to menu in navebar leads another subpage /subpage
i have a menu bar as, HOME GALLERY When i click Home its the index page which is being display after when i click Gallary dropdown menu as house it redirects to search.html . BUT when i again click hotel it redirects to 127.0.0.1/search/ search1 insted of 127.0.0.1/search1. i have 3 web pages as: search.html, search1.html, search2.html. i am inheriting search.html to all of those HTML file. My code: Home Gallary house hotel hospital -- 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/b9c81c3c-30e0-4b3c-84cc-5316ac408089%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
linking diffirent wepages
my nav menu have 2 menus : Home , Search Names ie. from index page when i click student from Sub menu of Search names , it will redirects search.html after if i click again teacher from search.html it will redirects to search.html/ search1.html rather then search1.html only. it works normal only from index page. i am inheriting the nav menu from index page to all of other pages. what am i doing wrong ? Home Search Names student teachers non teaching -- 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/3bf58350-5f27-4b88-b803-1694ada2d6a6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Searching with respect to gender and BY name
Thank you so much it worked!! On Friday, 28 June 2019 20:27:23 UTC+5:45, jjmutumi wrote: > > Hello, > > I think it should work if you build the query sequentially. Like: > > def search(request): > if request.method=='POST': > srch = request.POST['srh'] > srchs = request.POST['gender'] > > if srchs or srch: > query = Snippet.objects > if srch: > query = query.filter(Q(name__istartswith=srch)) > if srchs: > query = query.filter(Q(gender__iexact=srchs)) > > if query.count() > 0: > return render (request,'search.html',{'sr': query}) > else: > messages.error(request,'no result found') > return HttpResponse("No name found please Add names ") > else: > return render(request,'search.html') > > return render(request,'search.html') > > On Friday, 28 June 2019 15:35:09 UTC+3, Surya Adhikari wrote: >> >> # my coding looks like this in views.py but somehow it only search by >> name no matter which gender i select .what am i doing wrong? >> >> def search(request): >> if request.method=='POST': >> srch = request.POST['srh'] >> srchs = request.POST['gender'] >> >> if srch and srchs: >> match = Snippet.objects.filter(Q(name__istartswith=srch)) >> matchs = Snippet.objects.filter(Q(gender__iexact=srchs)) >> >> if match and matchs: >> return render (request,'search.html',{'sr':match}) >> #return render (request,'search.html',{'sr':match}) >> else: >> messages.error(request,'no result found') >> # return HttpResponse("No name found please Add names ") >> >> else: >> # return HttpResponseRedirect('/search/') >> return render(request,'search.html') >> >> return render(request,'search.html') >> >> -- 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/69c1dc32-037f-4303-8384-de35c34e53b3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Searching with respect to gender and BY name
# my coding looks like this in views.py but somehow it only search by name no matter which gender i select .what am i doing wrong? def search(request): if request.method=='POST': srch = request.POST['srh'] srchs = request.POST['gender'] if srch and srchs: match = Snippet.objects.filter(Q(name__istartswith=srch)) matchs = Snippet.objects.filter(Q(gender__iexact=srchs)) if match and matchs: return render (request,'search.html',{'sr':match}) #return render (request,'search.html',{'sr':match}) else: messages.error(request,'no result found') # return HttpResponse("No name found please Add names ") else: # return HttpResponseRedirect('/search/') return render(request,'search.html') return render(request,'search.html') -- 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/35681b7b-b12e-45bc-8206-396bd3874266%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.