#1802 closed defect (fixed)
changing description name gives error with
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (2)
comment:1 by , 19 years ago
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
fix in django/contrib/auth/management.py:31 instead of:
use:
perhaps one should add a way to reflect the new name also here.