Tuesday, January 23, 2018

Re: django 2 - How do I make search box?



On Tuesday, January 23, 2018 at 11:34:48 AM UTC, Carl Brubaker wrote:
I am trying to make a search field in a template and connect it back to my database so I can "find" stuff.

I found this in the django docs:

>>> Author.objects.filter(name__unaccent__icontains='Helen')  [<Author: Helen Mirren>, <Author: Helena Bonham Carter>, <Author: Hélène Joy>]

which is helpful, but I'm having trouble connecting to my template:

<input type="search" />

I'm not sure what to call my variable or how to integrate it into models. All of the existing stuff I can find is django 1.

 
Thanks!


--
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+unsubscribe@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/0b47422a-32b1-48d8-a0ab-10b3e2665c24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment