Opened 19 years ago

Closed 18 years ago

Last modified 12 years ago

#1503 closed defect (fixed)

model validation does not report duplicate auto-generated "id" column

Reported by: mir@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: magic-removal
Severity: normal Keywords:
Cc: mir@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is a complicated case ...

If you set up a model class with a field named "id" and without any primary key, Django will add an AutoField named "ID". This leads to a duplicate field name, producing strange effects (django.db.models.query.find_field will report that there's no "id" field at all ...) which are hard to hunt down.

Change History (2)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [3100]) Fixed #1503 -- Improved model validator to throw an error if a model doesn't manually define a primary key and has a field named 'id', which conflicts with the auto-primary-key convention. Thanks, mir@…

comment:2 by anonymous, 12 years ago

Easy pickings: unset
UI/UX: unset
Note: See TracTickets for help on using tickets.
Back to Top