Opened 7 years ago

Closed 3 years ago

#7184 closed New feature (fixed)

inspectdb outputs primary key

Reported by: mbeattie Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords: inspectdb primary key
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

As noted in the djangobook http://new.djangobook.com/en/1.0/chapter16/ the inspectdb command outputs what are likely primary key fields as through they weren't. This simple change makes it insert them as comments.

Attachments (2)

inspectdb.diff (167 bytes) - added by mbeattie 7 years ago.
diff
inspectdb.txt (167 bytes) - added by mbeattie 7 years ago.
diff

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by mbeattie

diff

Changed 7 years ago by mbeattie

diff

comment:1 Changed 7 years ago by mbeattie

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by ericholscher

  • milestone set to post-1.0
  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:4 Changed 5 years ago by mtredinnick

  • Triage Stage changed from Design decision needed to Accepted

Put a space after the "#" symbol for comments to produce reasonable Python style, but otherwise looks pretty good.

comment:5 Changed 5 years ago by lukeplant

  • Needs tests set
  • Patch needs improvement set

Patch should be in unified diff form, and needs tests.

comment:6 Changed 4 years ago by gabrielhurley

  • Component changed from django-admin.py inspectdb to Core (Management commands)

comment:7 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:8 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:9 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:10 Changed 3 years ago by claudep

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

As far as I understand the problem, inspectdb should now detect a "standard" primary key (id = model.AutoField(primary_key=True)) and not ouptut it in that case.

If I missed an issue, feel free to reopen and provide a more concrete example.

Note: See TracTickets for help on using tickets.
Back to Top