﻿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
2259	Primary keys should be readonly by default in admin	ed@…	修昊	"When creating a simple model with a non-integer primary key, the Admin interface shows the field as editable, but when making a change, it seems to execute an incorrect query.

For example:

{{{
class Group(models.Model):
    name = models.CharField(maxlength=32, primary_key=True)

    def __str__(self):
        return self.name

    class Admin:
        list_display = ('name',)
        search_fields = ('name',)
}}}

When changing the primary key field (e.g. from 'Test' to 'TestX') when editing a record, a ProgrammingError exception is raised.  The SQL that is generated is:

{{{
UPDATE ""config_group"" SET WHERE ""name""='Test'
}}}

This is missing the primary key field to be changed after SET.

This is with the latest SVN code.  It seems to be an issue around line 179 of db/models/base.py where it only adds the non-pk columns after SET."	Bug	assigned	contrib.admin	dev	Normal			sime Russell Keith-Magee anssi.kaariainen@… django@… jedie	Accepted	1	0	0	1	0	0
