Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow multiple values in query strings #73

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Unlike other Plotly projects, `dash-labs` does **not** adhere to semantic versio
## unreleased

### Added
-[#61](https://github.com/plotly/dash-labs/pull/61). New feature for handling variables in the URL.

- [#61](https://github.com/plotly/dash-labs/pull/61). New feature for handling variables in the URL.
### Fixed
- [#73](https://github.com/plotly/dash-labs/pull/73). Allow for multiple values in query strings.
## 1.0.1

### Fixed
Expand Down
11 changes: 3 additions & 8 deletions dash_labs/plugins/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def register_page(
e.g. based on path_template: `/asset/<asset_id` to `/asset/none`
e.g. based on module: `pages.weekly_analytics` to `/weekly-analytics`

- path_template:
- `path_template`:
Add variables to a URL by marking sections with <variable_name>. The layout function
then receives the <variable_name> as a keyword argument.
e.g. path_template= "/asset/<asset_id>"
Expand Down Expand Up @@ -470,13 +470,8 @@ def _parse_query_string(search):

parsed_qs = {}
for (k, v) in parse_qs(search).items():
first = v[0] # ignore multiple values
try:
first = json.loads(first)
except:
pass

parsed_qs[k] = first
v = v[0] if len(v) == 1 else v
parsed_qs[k] = v
return parsed_qs


Expand Down