﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28460	CharField primary keys with underscores are reversed incorrectly in admin links	cypreess	nobody	"This bug is probably related to ticket #22266 and it still appears in 1.11.2

1) I am using CharField for models primary key fields. Example value of id field for custom User model: `usr_12345`
2) In admin list view ID's are represented corectly: `usr_12345`
3) In admin object detail view link to the page contains extra `5F` after underscore `/admin/accounts/user/usr_5F12345/change/`

Somehow the problem affects 3rd party apps (I am trying to use django-loginas) which renders in template link: `{% url 'loginas-user-login' object_id %}` ending up redirecting to incorrect link `/admin/login/user/usr_5F12345/` (which will do 404 because User `usr_5F12345` is not existing obviously).

However at the same time reverse function seems to work fine:


{{{
>>> reverse(""loginas-user-login"", args=['usr_12345'])
'/admin/login/user/usr_12345/'
}}}

which is confusing."	Bug	closed	contrib.admin	1.11	Normal	duplicate			Unreviewed	0	0	0	0	0	0
