7👍
✅
(p.id)
is just p.id
in parentheses, (p.id,)
is a single-element tuple.
Parenthesized forms in docs
3👍
The trailing comma is required if a tuple only has one item to differentiate a tuple from stylistic parenthesis.
Similar questions:
Python tuple comma syntax rule
Why does adding a trailing comma after a string make it a tuple
- [Django]-Can't get media files in heroku
- [Django]-Deleted Django Migrations Folder
- [Django]-Django async update a single page template
Source:stackexchange.com