Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#7785 closed (fixed)

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

Reported by: Rudolph 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:

Description

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 7 years ago.
Adds note to docs about field types for primary keys

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Rudolph

Adds note to docs about field types for primary keys

comment:1 Changed 7 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 7 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 7 years ago by Simon Greenhill

  • Has patch set
  • milestone set to 1.0 beta
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:4 Changed 7 years ago by russellm

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

(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 3 years ago by jacob

  • milestone 1.0 beta deleted

Milestone 1.0 beta deleted

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