Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7785 closed (fixed)

Add note about the requirement of integer primary keys in generic relations

Reported by: Rudolph Froger Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


For Generic Relations using an integer primary key is a requirement. Non-integer primary keys will not work. I will add a patch to add this note to the docs.

Please also see the discussion on Google Groups.

Attachments (1)

note-about-primary-keys.diff (603 bytes) - added by Rudolph Froger 8 years ago.
Adds note to docs about field types for primary keys

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Rudolph Froger

Adds note to docs about field types for primary keys

comment:1 Changed 8 years ago by charmless

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

I've been using non-integer primary keys with my generic relations just fine. In fact, with Postgres 8.2 (but not 8.3), integers are converted to strings, so I can have my relations reference models with both string and integer primary keys. I have no idea about dates. This mixing is a Postgres 8.2-specific 'hack', but there's nothing standing in the way of heterogeneous non-integer primary keys for generic relations.

So I'm a bit confused and worried regarding what this ticket is about.

comment:2 Changed 8 years ago by charmless

... and then I read the actual patch proposed and was enlightened. Ignore me. (though a method for handling heterogeneous keys, as the psql hack above does, in a general way, might be nice.)

comment:3 Changed 8 years ago by Simon Greenhill

Has patch: set
milestone: 1.0 beta
Triage Stage: UnreviewedReady for checkin

comment:4 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [7976]) Fixed #7785 -- Added a note in the contenttypes documentation that GenericRelations must share a common field type for primary keys. Thanks to Rudolph for the suggestion and initial draft.

comment:5 Changed 5 years ago by Jacob

milestone: 1.0 beta

Milestone 1.0 beta deleted

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