Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

python - How to Stack Multiple Search Parameters in URL with Django and Ajax

I'm trying to create a filter system on a webpage such that the user can bookmark their searches. The page loads from the basic url:

path('foobar/counts', views.foobarCount, name='foobar_counts')

This URL loads the proper template on top of the base template and includes everything needed. From there, a series of filters are set up, which send an ajax request to the server. The user can select as many or as few filters as they'd like. The Ajax url is set up as follows:

path('foobar/counts/filter', views.foobarCountFilter, name='foobar_count_filter')

This all works just fine when the user starts at the foobar/counts URL, but when they want to paste in something like:

/foobar/counts/filter?startDate=2001-01-12&endDate=2021-01-12&startComp=2021-01-01&endComp=2021-01-31&assigns...

The system properly receives the Ajax request and brings back the proper information, but it does not include the other templates needed to load the webpage. It displays as essentially a plaintext version. Is there a minimally invasive way to retroactively load all the necessary templates when pasting in the search URL?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...