﻿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
2023	"""View on site"" breaks when model specifies primary key other than ID"	emeraldjunk-django@…	Adrian Holovaty	"Model A:
{{{
class Photo(models.Model):
    title = models.CharField(maxlength = 50)
    slug = models.SlugField('Slug',  prepopulate_from = ('title',),
            help_text='Use auto-suggestion or a simple text string.',
          )
    [...more stuff, ImageField, etc...]
}}}
Model B:
{{{
class Photo(models.Model):
    title = models.CharField(maxlength = 50)
    slug = models.SlugField('Slug',  prepopulate_from = ('title',),
            help_text='Use auto-suggestion or a simple text string.',
            primary_key='True')
    [...more stuff, ImageField, etc...]
}}}

Model A works fine in the admin (i.e. you can click on ""View on site"" and you can view the photo), Model B however gives you a 404. Looking at the relevant entry for urls.py from the admin it seems that this expects a numerical  primary key and therefor breaks when e.g. the slug becomes primary key.

Note: using the slug as primary key came from copy-and-pasting an example I found on the web, not sure if this frowned upon anyway."		closed	contrib.admin	dev	normal	fixed			Unreviewed	0	0	0	0	0	0
