﻿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
24962	Objects with primary keys containing newlines do not get links to being edited in the admin list view	Alejandro Dubrovsky	nobody	"The admin list view of an object lists each object and does a 
{{{
reverse('admin:%s_%s_change' % (self.opts.app_label, self.opts.model_name), args=(quote(pk),), current_app=self.model_admin.admin_site.name)
}}}
to assign a change url for each one, skipping the link if the reverse fails. The 'quote' function there escapes a whole bunch of characters so as not to confuse the url pattern matcher but it forgets to escape newline.

Therefore, a model like this:
{{{
class Name(models.Model):
   name = models.TextField(primary_key=True)
}}}
with:
{{{
n = Name('John')
n.save()
o = Name('Have a \n newline')
o.save()
}}}

will list a link for John, but no link for 'Have a newline'

(The bug actually is triggered in quite a few other places in admin but the list view is the easiest one to see. I've attached some screenshots that I prepared earlier)

Change is a 2-character change to quote \n as well (attached)"	Bug	closed	contrib.admin	dev	Normal	fixed			Accepted	1	0	0	0	1	1
