problem with search in models

67 views
Skip to first unread message

quentin ladrier

unread,
May 8, 2016, 6:22:42 AM5/8/16
to django-watson discussion group
Hello,

I have a problem with the implementation of my specific search.
I want to perform a search only on specific model in my DB.
I use this syntax on my views : Search_result=watson.search(Search, models=(tiker,))
and when I start a search this error message occur : name 'tiker' is not defined
But when I perform a global search with : Search_result=watson.search(Search)
i don't have any errors  however I have too much results.

thanks for your help.
Regards,

Dave Hall

unread,
May 9, 2016, 4:30:52 AM5/9/16
to django-watson discussion group
You need to import your model before use:

from your_app.models import YourModel
search_results = watson.search("search term", models=(YourModel,))

--
You received this message because you are subscribed to the Google Groups "django-watson discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-watso...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-watson.
For more options, visit https://groups.google.com/d/optout.

quentin ladrier

unread,
May 11, 2016, 5:16:48 AM5/11/16
to django-watson discussion group
thanks for your answer. I forgot to import models
Reply all
Reply to author
Forward
0 new messages