Code

Opened 8 years ago

Closed 8 years ago

Last modified 20 months ago

#1503 closed defect (fixed)

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

Reported by: mir@… Owned by: adrian
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.

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 20 months ago by anonymous

  • Easy pickings unset
  • UI/UX unset

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.