开发者

Pass logged in user to haystack search

开发者 https://www.devze.com 2023-03-04 18:20 出处:网络
I want to show my search results in respect to account type of the current logged in user. Is it possible to pass user from request to object in urls? If not, how else can I pass it?

I want to show my search results in respect to account type of the current logged in user. Is it possible to pass user from request to object in urls? If not, how else can I pass it?

To be more specific. In haystack urls.py we have

url(r'^$', SearchView(), name='haystack_开发者_如何学Pythonsearch'),

Can I somehow to SearchView object pass current logged in user?


I didn`t notice that SearchViews has access to request so it is really easy to get user in this class.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号