﻿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
1802	changing description name gives error with	mdt@…	Adrian Holovaty	"after changing the verbose_name, a manage.py syncdb gave an error:

{{{
Traceback (most recent call last):
  File ""./manage.py"", line 11, in ?
    execute_manager(settings)
  File ""django/core/management.py"", line 1237, in execute_manager
    execute_from_command_line(action_mapping)
  File ""django/core/management.py"", line 1163, in execute_from_command_line
    action_mapping[action]()
  File ""django/core/management.py"", line 473, in syncdb
    app=app, created_models=created_models)
  File ""django/dispatch/dispatcher.py"", line 347, in send
    sender=sender,
  File ""django/dispatch/robustapply.py"", line 47, in robustApply
    return receiver(*arguments, **named)
  File ""django/contrib/auth/management.py"", line 34, in create_permissions
    p.save()
  File ""django/db/models/base.py"", line 185, in save
    ','.join(placeholders)), db_values)
  File ""django/db/backends/util.py"", line 12, in execute
    return self.cursor.execute(sql, params)
  File ""django/db/backends/sqlite3/base.py"", line 74, in execute
    return Database.Cursor.execute(self, query, params)
pysqlite2.dbapi2.IntegrityError: columns content_type_id, codename are not unique
}}}

content of the table is:

{{{
sqlite> select * from auth_permission;
...
31|Can add TrainingsTagebuch|11|add_trainingstagebuch
32|Can change TrainingsTagebuch|11|change_trainingstagebuch
33|Can delete TrainingsTagebuch|11|delete_trainingstagebuch
}}}

executed sql is:

{{{
SELECT ""auth_permission"".""id"",""auth_permission"".""name"",""auth_permission"".""content_type_id"",""auth_permission"".""codename"" FROM ""auth_permission"" WHERE (""auth_permission"".""codename"" = ? AND ""auth_permission"".""name"" = ? AND ""auth_permission"".""content_type_id"" = ?) ['add_trainingstagebuch', u'Can add Eintrag im Trainingstagebuch', 11]
INSERT INTO ""auth_permission"" (""name"",""content_type_id"",""codename"") VALUES (?,?,?) [u'Can add Eintrag im Trainingstagebuch', 11, 'add_trainingstagebuch']
}}}

because the name is used in the where lookup django does not find the record and tries to insert a new one.

"	defect	closed	contrib.admin		normal	fixed			Unreviewed	0	0	0	0	0	0
