Rest framework autocomplete

已查看 59 次
跳至第一个未读帖子

Soumen Khatua

未读,
2019年8月19日 23:45:272019/8/19
收件人 django...@googlegroups.com
Hi guys,
 I want to implement autocomplete options like if someone type 'a' if it is contains in between any data it should provide the suggestion of the matched words. Then it will return first 25 matched data, how I can do that by using django rest framework. Please help me with source code.

Thank you in advance

Regards,
Soumen

Abu Yusuf

未读,
2019年8月20日 00:03:382019/8/20
收件人 django...@googlegroups.com

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WYDQP5YgDZcHC_e8_c%2BTbs3CNEuxutFtmcvmZF-gqu2xA%40mail.gmail.com.

Soumen Khatua

未读,
2019年8月20日 00:56:322019/8/20
收件人 django...@googlegroups.com
My query is little bit different suppose I type A in the search box imtjen it should recommend AAA, ABC if they are exist into the database. How I can do that?? 

Andréas Kühne

未读,
2019年8月20日 03:56:292019/8/20
收件人 django...@googlegroups.com
Hi,

This is exactly what you do with filtering and pagination? Could you please specify why it doesn't suit your usecase? I need to understand more to actually be able to help you :)

Regards,

Andréas


DANIEL URBANO DE LA RUA

未读,
2019年8月20日 04:04:072019/8/20
收件人 django...@googlegroups.com
You will need to load the data first and for the rest use javascript 

Soumen Khatua

未读,
2019年8月20日 04:15:152019/8/20
收件人 django...@googlegroups.com
Suppose If I'll type 'A' and database contains some sentences as an example AABC, ABC, BCA.It should suggest all the names those are contains A. If I need to javascript then I can configure could you tell me please. 

Thank you for your response. 

Andréas Kühne

未读,
2019年8月20日 04:22:552019/8/20
收件人 django...@googlegroups.com
Ok - so what you need to do is configure the endpoint to use the filters and pagination. Then you need to connect to the backend with javascript and populating the results by adding to the dom.

Here is something that is more or less what you want to do - however you need the backend code to get this to work:

Regards,

Andréas


Soumen Khatua

未读,
2019年8月20日 05:05:552019/8/20
收件人 django...@googlegroups.com
Could you tell me how can I configure javascript in my rest api apps. Actually I'm new to this area.

Thank you 

Andréas Kühne

未读,
2019年8月20日 05:20:072019/8/20
收件人 django...@googlegroups.com
If you read the article I sent you he goes through the javascript side and what you need to do on that side. However the endpoint URL you need to decide yourself - thats the part restframework helps you with.

Regards,

Andréas


回复全部
回复作者
转发
0 个新帖子