How do you suggest we retrieve querystring or route values? #68
-
Let's say I want to create something like a blog, where we have an identifier in the query string or route for a post. I know how to do this in Flask, but I'm wondering if you have other thoughts on how to implement this with Pynecone. My sense is that you've abstracted this the way you have with several other things, but I couldn't find any examples. So, basically, let's say I have a list of items and want them to link to details. Or let's say I want people to be able to share URLs with dynamic querystring values. How do you suggest I implement this? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It seems that we can't do this now, but it should be consider in the comming versions. maybe we can add a variable in the root state iof the App? Just like |
Beta Was this translation helpful? Give feedback.
-
This isn't supported at the moment, but we have plans to add it soon. We have a ticket to track it here. The design we had in mind currently that the render functions take in the query arguments. So if you had a blog page and you want the path to be
Then you could add a route like
For query parameters, we would make them accessible as kwargs.
In the app state, we would provide some way to access the query parameters. So in the event handlers, maybe you could call This design is still in process, I'll post updates on the linked ticket as we make progress. We're open to ideas here. |
Beta Was this translation helpful? Give feedback.
This isn't supported at the moment, but we have plans to add it soon. We have a ticket to track it here.
The design we had in mind currently that the render functions take in the query arguments. So if you had a blog page and you want the path to be
/blog/<post_id>
you could define your render function like:Then you could add a route like
For query parameters, we would make them accessible as kwargs.
In the app state, we would provide some way to access the query parameters. So in the event handlers, maybe you could call
self.get_query_params()
…