etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

KeyError at /dashboard/ u'query' #210

Closed neeti25 closed 7 years ago

neeti25 commented 7 years ago

Where do i add this piece of code to render search results - {% search_results search_entry_list %}? Also do i need to define the built-in search view in my app's views.py to get it working?

etianen commented 7 years ago

You need to add the built-in views to your urls.py:

https://github.com/etianen/django-watson/wiki/Built-in-views

You can then copy the watson/search_results.html template into your template root and customize it.

On 7 July 2017 at 09:20, neeti25 notifications@github.com wrote:

Where do i add this piece of code to render search results - {% search_results search_entry_list %}? Also do i need to define the built-in search view in my app's views.py to get it working?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/210, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCOOjZJJefRNQQzJE-G0r9CH1Aorlks5sLeoygaJpZM4OQomo .

neeti25 commented 7 years ago

This is the traceback that i get: http://dpaste.com/3QBXXGH#wrap Here's my search form in header.html

And i haven't modified anything in search_results.html after pasting it in my app. And i registered my models like this: class MgmtConfig(AppConfig): name = 'mgmt' def ready(self): User = self.get_model("User") watson.register(User) Student = self.get_model("Student") watson.register(Student) Teacher = self.get_model("Teacher") watson.register(Teacher)

i don't understand the error exactly but it's somewhere in rendering the context of query string. Please help.

etianen commented 7 years ago

Your search form isn't in the email. Could you try again?

On 7 July 2017 at 11:19, neeti25 notifications@github.com wrote:

This is the traceback that i get: http://dpaste.com/3QBXXGH#wrap http://url Here's my search form in header.html `

Signed in as {{user.first_name}} Logout `

And i haven't modified anything in search_results.html after pasting it in my app. And i registered my models like this: class MgmtConfig(AppConfig): name = 'mgmt' def ready(self): User = self.get_model("User") watson.register(User) Student = self.get_model("Student") watson.register(Student) Teacher = self.get_model("Teacher") watson.register(Teacher)

i don't understand the error exactly but it's somewhere in rendering the context of query string. Please help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/210#issuecomment-313644591, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCNItba7l2Nasy2ewMY8KiXUo0desks5sLgZBgaJpZM4OQomo .

neeti25 commented 7 years ago

Yeah.

screenshot from 2017-07-07 16 53 16

etianen commented 7 years ago

Are you using the built-in views?

I'm confused, because the built-in views set the "query" context variable, and your traceback indicates that the "query" context variable is not set.

Furthermore, your error seems to be in the base.html template, which has nothing to do with django-watson.

On 7 July 2017 at 12:23, neeti25 notifications@github.com wrote:

Yeah.

[image: screenshot from 2017-07-07 16 53 16] https://user-images.githubusercontent.com/29422125/27955927-d081a384-6334-11e7-9407-0b44eda8df48.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/210#issuecomment-313656013, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCJTjzbOG21UKOPNHugTK8tX6RPtOks5sLhVEgaJpZM4OQomo .

neeti25 commented 7 years ago

Yes, thank you. The error occured because i hadn't upgraded to the latest version of Django 1.3.1. It works fine now.