Skip to content

Conversation

@EzzEddin
Copy link
Contributor

This adds more clarity on how to pass arguments to a URL route. It would save developers time figuring that out on their own, especially since the syntax of the url_for is a bit different from the Django's {% url %}

The id argument refers to the the id parameter sent to the read_item()
function call.
@github-actions
Copy link
Contributor

@tiangolo tiangolo added docs Documentation about how to use FastAPI investigate labels Mar 10, 2023
@mjpieters
Copy link

The extra example looks out of place in the normal pattern of the FastAPI documentation. I'd update the docs_src/templates/templates/item.html example to always include a <a href="{{ url_for('read_item', id=id) }}"> link in some way.

@tiangolo
Copy link
Member

@tiangolo tiangolo changed the title Fix templates doc 📝 Update template docs with more info about url_for Jan 11, 2024
@tiangolo
Copy link
Member

Thanks @EzzEddin! 🍰

And thanks for the idea @mjpieters! ☕

I updated the docs, the example code, and the tests a bit. 🤓

@tiangolo tiangolo enabled auto-merge (squash) January 11, 2024 22:22
@tiangolo tiangolo merged commit 0c79674 into fastapi:master Jan 11, 2024
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants