Skip to content

Instantly share code, notes, and snippets.

@ethagnawl
Created February 28, 2019 19:32
Show Gist options
  • Save ethagnawl/a65e5b0f43f182a34cc432624325f6dd to your computer and use it in GitHub Desktop.
Save ethagnawl/a65e5b0f43f182a34cc432624325f6dd to your computer and use it in GitHub Desktop.
Django Reverse for ... with arguments not found
You may see the following (confusing) error message when using trying to create an entity URL for an entity which uses an `AutoField` primary key
`Reverse for 'foo_update' with arguments '('',)' not found. 1 pattern(s) tried: ['foos/(?P<pk>[0-9]+)/edit/$']`
So, in your view:
`<a href="{% url 'foo_update' foo.id %}">edit</a>`
... should be:
`<a href="{% url 'foo_update' foo.foo_id %}">edit</a>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment