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

📝 Update template docs with more info about url_for #5937

Merged
merged 5 commits into from Jan 11, 2024

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

📝 Docs preview for commit 0e2afee at: https://63d672b64f22084e50eecfa3--fastapi.netlify.app

@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
Owner

📝 Docs preview for commit 83babfb at: https://2f348dd8.fastapitiangolo.pages.dev

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

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 tiangolo:master Jan 11, 2024
39 checks passed
nilslindemann added 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.

None yet

3 participants