Re: [Django] #373: Add support for multiple-column primary keys

83 views
Skip to first unread message

Django

unread,
May 9, 2011, 9:19:59 PM5/9/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: dcramer
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by rogelio.dominguez@…):

* cc: rogelio.dominguez@… (added)


--
Ticket URL: <http://code.djangoproject.com/ticket/373#comment:79>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 12, 2011, 8:18:02 AM5/12/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: new
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by koniiiik):

* owner: dcramer => koniiiik
* status: assigned => new


Comment:

I'll try to post progress updates here from time to time.

I just kicked off a thread on django-developers@ to discuss the final API
(https://groups.google.com/d/topic/django-
developers/rF79c8z65cQ/discussion). I'll appreciate comments from anyone
interested. (I'm posting a note in here because I realize not everyone
reads the mailing list.)

--
Ticket URL: <http://code.djangoproject.com/ticket/373#comment:80>

Django

unread,
May 12, 2011, 8:18:33 AM5/12/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by koniiiik):

* status: new => assigned


--
Ticket URL: <http://code.djangoproject.com/ticket/373#comment:81>

Django

unread,
May 12, 2011, 9:52:33 AM5/12/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by RaceCondition):

* cc: eallik@… (removed)


--
Ticket URL: <http://code.djangoproject.com/ticket/373#comment:82>

Django

unread,
Jun 6, 2011, 11:54:38 AM6/6/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Changes (by drdee):

* cc: drdee (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:83>

Django

unread,
Jul 1, 2011, 5:51:40 AM7/1/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by davidhalter88@…):

* cc: davidhalter88@… (added)
* ui_ux: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:84>

Django

unread,
Jul 9, 2011, 7:31:19 PM7/9/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

Okay, a progress update:
there's a branch on github: https://github.com/koniiiik/django/

Currently, you can define a composite field, set it as the primary key and
basically that's it. No support in ForeignKey or any other relationship
fields yet, that's what I'll work on starting with the next week. Model
validation is missing as well, i. e. CompositeFields are not yet checked
for correctness.

The admin should just work, try to explore its functionality and please
let me know if you find something broken. I tried to test everything I saw
but of course, I may have forgotten about a few details.

All in all, feel free to clone the repo and try it out, any feedback I get
will push me forward.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:85>

Django

unread,
Jul 13, 2011, 9:44:34 AM7/13/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by streeter):

* cc: streeter (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:86>

Django

unread,
Jul 13, 2011, 10:52:29 AM7/13/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by gezuru@…):

* cc: gezuru@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:87>

Django

unread,
Jul 27, 2011, 11:53:20 AM7/27/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

I've tried using this when one of the component fields is a relationship
field, but it doesn't seem to work. I might be doing it wrong. I've
attached a small example that can be applied on top of koniiiik's existing
tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:88>

Django

unread,
Jul 27, 2011, 11:54:43 AM7/27/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by dcrosta):

* cc: dcrosta (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:89>

Django

unread,
Jul 27, 2011, 1:39:21 PM7/27/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

Ignore test-m2m for the time being, I didn't mean the FK target to have a
composite PK. I'll try to get a useful test case out of my real model
tomorrow.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:90>

Django

unread,
Jul 28, 2011, 1:13:26 PM7/28/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

Follow up here: https://github.com/koniiiik/django/pull/1

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:91>

Django

unread,
Aug 10, 2011, 3:36:21 PM8/10/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by skizzay):

* cc: andrewford55139@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:92>

Django

unread,
Aug 11, 2011, 12:08:10 PM8/11/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by garen.p@…):

* cc: garen.p@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:93>

Django

unread,
Aug 11, 2011, 12:51:58 PM8/11/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by RaceCondition):

Why am I getting notifications about this issue even though I'm not in the
CC? Or at least Trac only allows me to Add myself, not Remove.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:94>

Django

unread,
Aug 11, 2011, 12:52:09 PM8/11/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by RaceCondition):

* cc: eallik@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:95>

Django

unread,
Aug 11, 2011, 12:52:27 PM8/11/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New | Status: assigned
feature | Component: Database layer
Milestone: | (models, ORM)
Version: | Severity: Normal
Resolution: | Keywords: database
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by RaceCondition):

* cc: eallik@… (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:96>

Django

unread,
Oct 17, 2011, 9:14:35 AM10/17/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by shelldweller):

* cc: shelldweller (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:97>

Django

unread,
Oct 17, 2011, 9:41:00 AM10/17/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by RaceCondition):

From now on I'm reporting code.djangoproject.com e-mails as spam as
removing myself from CC has no effect whatsoever.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:98>

Django

unread,
Oct 17, 2011, 9:58:41 AM10/17/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by aaugustin):

(off-topic for this ticket)

!RaceCondition, given
[https://code.djangoproject.com/ticket/16763#comment:8 the comment you
left on ticket 16763], it seems that you're aware of the situation.
Whenever you contribute to a ticket, you will be notified of further
updates by email.

We don't intend to change this behavior because many contributors rely on
it. However, we have a manual procedure to remove people who no longer
want to receive these emails.
[https://code.djangoproject.com/ticket/16763#comment:7 Just follow the
instructions!].

And of course, don't post while logged-in, or your email will be added to
the CC list again. As an alternative, I suggest posting without logging in
and signing your messages.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:99>

Django

unread,
Oct 17, 2011, 10:01:24 AM10/17/11
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by RaceCondition):

So, um, what is then the purpose of the CC list if you get messages
anyway?
Basically, still, code.djangoproject.com is sending out spam; it's
irrelevant if it's a feature for some people.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:100>

Django

unread,
Jan 9, 2012, 10:31:09 AM1/9/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by pawel.suwala@…):

* cc: pawel.suwala@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:101>

Django

unread,
Jan 9, 2012, 10:52:50 AM1/9/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by lau):

We're still a bunch of hopeful people holding our breaths for this feature
to enter django. What's the status? Looks like there's lots of activity on
github, is the code at a state where it's reasonably stable? In which case
I'd be happy to start testing on some real-life data.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:102>

Django

unread,
Jan 9, 2012, 11:18:13 AM1/9/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

Well, the current status is, the `soc2011/composite-fields` branch is
stable and I'm just keeping it up-to-date with master. There is some
documentation, though I'm afraid it is not complete. Anyway, it only works
with non-relationship fields.

As for relationship fields and the `auxiliary_fk_fields` branch, it is
still only in the refactoring phase. I had to modify `ForeignKey`
extensively and it's still not there but I'm trying to fix the bugs one by
one. Once the whole test suite succeeds (except for `CompositeField`
tests) I can resume working on composite fields themselves.

Note that this is quite a tedious process since most of the remaining
failing test cases require individual handling, therefore I'll appreciate
any help with this. Feel free to fork me on github and send pull requests.
I don't always find enough free time to work on this myself, I've still
got some exams to do and also a Bc. thesis to work on...

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:103>

Django

unread,
Jan 10, 2012, 3:38:05 AM1/10/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Pawel Suwala <pawel.suwala@…>):

I have bugfixed and ported the `CompositeKey` base class posted by Ravi (4
years ago!) to work with current django version.

Here comes the snippet for people who can't wait for real-ck support in
django.
{{{
################################################################################################
# Base Class for weak-emulation of composite primary key.
# To have composite keys workaround in your model, follow these steps:
# Step1: Paste this snippet before your models in models.py
# Step2: Extend you class from CompositeKeyModel
# Step3: Define 'unique_together=(("field1","field2","field3"),) in your
models Meta class
# Step4: Create db-table by hand.
#
# That's it! The save() on the instances of these models should have the
composite key effect.
#
# Send feedback to: pawel....@fsfe.org
##################################################################################################
}}}

{{{
#!python
from django.db import models
from django.db.models.base import ModelBase

class CompositeKeyModel(models.Model): pass

class IntermediateModelBase(ModelBase):
def __new__(cls, name, bases, attrs):
if CompositeKeyModel in bases:
if bases == (CompositeKeyModel,):
# create the class via the super method
newclass = ModelBase.__new__(ModelBase, name, (models.Model,),
attrs)
# but then make it inherit from our model class
newclass.__bases__ = (CompositeKeyModel,)
return newclass
else: raise Exception, "IntermediateModelBase does not support more
than one base"
else:
return type.__new__(cls, name, bases, attrs)


class CompositeKeyModel(models.Model):
__metaclass__ = IntermediateModelBase
def save(self, *args, **kwargs):
filter = {}
#contruct model filter on the fly for the fields that listed in
the
# 'unique_together' meta attribute

if not self._meta.unique_together:
raise ValueError('Specify Meta.unique_together to emulate
Composite pk')

for field_name_list in self._meta.unique_together:
for field in field_name_list:
filter[field]='%s' % (self.get_field_value(field))

#use the generated filter to check if the object already exist
# if so fetch it
fetched = self.__class__.objects.complex_filter(filter)
#if fetched, then get its primary key and set it into the object
instance
#that is being saved.
if(len(fetched) > 0):
pk = self.get_primary_key()
self.__setattr__(pk.name,fetched[0].__getattribute__(pk.name))

#finally call the super class i.e Model save() method
models.Model.save(self, *args, **kwargs)

def _is_foreign_key(self, field): # there must be a better way to do
this
meta_class = getattr(field.__class__, '__metaclass__', None)
return meta_class == ModelBase

def get_field_value(self, fieldName):
field_value = getattr(self, fieldName)
if self._is_foreign_key(field_value):
return field_value.pk
return field_value

def get_primary_key(self):
for field in self._meta.fields:
if (field.primary_key):
return field

raise Exception('Your model must have a dummy primary key (id)')
}}}
{{{
#################################################################################################
## example:
#class MyModel(CompositeKeyModel):
# id = models.AutoField(primary_key=True) # dummy-for-
django
# user = models.ForeignKey(User)
# mess = models.ForeignKey(Message)
# atta = models.ForeignKey(Attachment)
#
# class Meta:
# unique_together = (('user', 'mess', 'atta'),)
#
# -- You will need to make this table by hand. For postgresql:
#CREATE TABLE app_mymodel (
# id integer NOT NULL, -- dummy, NO PrimaryKey CONSTRAINT
# user_id integer NOT NULL, -- Foreign key to some table
# mess_id integer NOT NULL, -- Foreign key to some table
# atta_id integer NOT NULL -- Foreign key to some table
#);

# -- create sequence for ID field (like MySQL auto-increment, but without
pk)
# CREATE SEQUENCE app_mymodel_id_seq
# START WITH 1
# INCREMENT BY 1
# NO MINVALUE
# NO MAXVALUE
# CACHE 1;
# ALTER SEQUENCE app_mymodel_id_seq OWNED BY app_mymodel.id;

# -- Add real composite Primary Key
# ALTER TABLE ONLY app_mymodel
# ADD CONSTRAINT comp_key PRIMARY KEY (user_id, mess_id, atta_id);


>>> MyModel.objects.create(user_id=1, mess_id=5, atta_id=7)
<MyModel: 1_5_7>
>>> MyModel.objects.create(user_id=1, mess_id=5, atta_id=7)
IntegrityError: duplicate key value violates unique constraint
DETAIL: Key (user_id, mess_id, atta_id)=(1, 8383, 1321) already exists.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:104>

Django

unread,
Aug 13, 2012, 1:41:22 PM8/13/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by cuboci):

* cc: cuboci (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:105>

Django

unread,
Sep 2, 2012, 12:16:47 AM9/2/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by bignose):

* cc: bignose (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:106>

Django

unread,
Sep 4, 2012, 2:20:51 AM9/4/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kitsunde):

* cc: kitsunde@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:107>

Django

unread,
Nov 16, 2012, 2:43:56 PM11/16/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by kkumler):

* cc: kkumler (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:108>

Django

unread,
Dec 12, 2012, 2:40:37 PM12/12/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by thisgenericname@…):

* cc: thisgenericname@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:109>

Django

unread,
Dec 13, 2012, 12:25:33 AM12/13/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by thisgenericname@…):

From skimming over the above comments, it seems that one of the biggest
issues is the representation of composite primary keys in URLs and in
references to model.pk

How feasible would it be to have a set of model methods that:

1) Given a set of primary key fields, return a string representation of
the composite key with the requirement that this mapping must be 1:1

2) Given a string representation of a primary key, return some sort of
structure that identifies what fields should be at which values...
Essentially the inverse of the above.

1 allows the generation of URLs, and allows things that examine model.pk
to continue to function.

2 creates the framework necessary to support queries that dereference the
pk, including lookups and possibly foreign keys.

The one requirement is that the composite-key-to-string bit must produce
output that has only one possible interpretation... e.g does escaping of
commas/slashes/whatever as needed. In the vast majority of cases using
integer ids, composites can probably be in the form of 1.5 or 1-5 or such
and escaping is a non-issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:110>

Django

unread,
Dec 13, 2012, 6:27:23 AM12/13/12
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

Not at all, this is an issue that has been brought up years ago and it
simply ignited the biggest discussions because this is one of the easiest
things about this project and practically anyone can give their opinions
on that. Personally I spent about a few hours thinking about the string
representation, most of which was spent reading the comments on this
ticket and then concluding that this is not really an issue.

More precisely, to implement a working string representation suitable for
the admin, this is just about everything you need:
https://github.com/koniiiik/django/blob/soc2011/composite-
fields/django/db/models/fields/composite.py#L151 and
https://github.com/koniiiik/django/blob/soc2011/composite-
fields/django/db/models/fields/composite.py#L135

There are much more difficult aspects. The work is currently stalled on a
refactor of `ForeignKey` and friends. I haven't had much time to work on
this lately because it is the end of semester here and school's been
keeping me busy but I still intend to work on this when I get a bit of
free time. Unless someone wants to take over in which case I would be glad
to assist in any way I can.

However, one more thing about the string representation, there is one
nontrivial issue that hasn't been discussed in this ticket at all –
`GenericForeignKey`. Using `GenericForeignKey` you can create SQL joins
between the model containing a GFK and an arbitrary model. The value of a
GFK pointing to a composite primary key should probably be a string, at
least I don't have any better ideas. However, to be able to create a SQL
join between the GFK and the composite field, there needs to be a way to
reproduce the string encoding of the composite value in SQL. Something
like
{{{
#!python
blog_posts.objects.annotate(Max('comments__date'))
}}}
should generate roughly this SQL query:
{{{
#!sql
SELECT blog_posts.date, blog_posts.title, blog_posts.content,
MAX(comments.date)
FROM blog_posts INNER JOIN comments ON (comments.object_id =
PERFORM_ESCAPE(blog_posts.date, blog_posts.title))
WHERE comments.content_type = '''the content type of blog_posts'''
GROUP BY (blog_posts.date, blog_posts.title)
}}}

The important bit is `PERFORM_ESCAPE(blog_posts.date, blog_posts.title)`
which should probably be a rather complex SQL expression that takes all
the constituents of a composite field, turns them into strings, escapes
them appropriately and generates one output string out of them. This
expression will necessarily be strongly backend-dependent but the encoding
should also be consistent across backends.

The bad thing about this is that we need to get this right on the first
try. Once we release this feature with a certain encoding, we'll have to
stick to that because of backwards compatibility, we can't require all
users of this feature to migrate their data each time we change the
encoding. With admin URLs this is not an issue as changing the string
representation there would just result in slightly different URLs but the
admin would still work just fine.

Actually, the last sentence is not entirely true with my current
implementation because the admin also uses parts of the contenttypes
framework to store the log of admin activity and currently I put the same
value in there as the one used in the URL, which means that if I changed
the representation, all of my logged admin activity would point to non-
existing objects.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:111>

Django

unread,
Feb 26, 2013, 12:16:26 AM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by jeremyt):

Where does this issue stand on the Django timeline? Have we settled on a
solution (I like the approach of the composite field koniiiik has done). I
would like to see a primary_key option being placed in the Meta class as
well.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:112>

Django

unread,
Feb 26, 2013, 11:03:38 AM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

Adding a `primary_key` option to `Meta` would be redundant, both the
current API for single-column PKs and the proposed API for composite PKs
use the `primary_key` boolean flag on a `Field` instance. And as far as I
understand, attempts to add a new `Meta` option are usually turned down by
the core team (similar to project-level settings). However, if you have
good arguments, feel free to state them and this may still be considered.

As far as the progress goes, there is no timeline. The work is stalled
once again for lack of time (school and other projects requiring immediate
attention) but if the core team agrees, I'd like to take this to the final
stages this summer as part of GSoC.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:113>

Django

unread,
Feb 26, 2013, 1:32:30 PM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by jeremyt):

I think the primary_key option in the Meta makes since from the ease of
use/flow prospective. I'm not saying that we should remove the option from
the field either but it should only be specified in one space. Just like a
CREATE TABLE statement really. If I have a primary key of a single column,
I can specify it on that one column directly but if I have multiple, I
place the primary key explanation as a constraint and not a column/field
itself.

In the end, the model would be the same except the user doesn't have to
manually declare the composite field(they still can if they want to
though), but system would generate the composite field for them and make
it the pk. But if the primary_key is missing everywhere, it continues to
create the AutoField pk just as it does today.

Does this disagree with the current schema?

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:114>

Django

unread,
Feb 26, 2013, 4:40:31 PM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

Well… The `Meta.primary_key` option was the first proposed API and the
outcome of [[https://groups.google.com/d/topic/django-
developers/Y0aAb792cTw/discussion|this discussion]] was that the BDFL
disliked this option and preferred an explicit `CompositeField`. The
arguments for either option were mostly a matter of personal preference,
therefore we settled on the one chosen by Jacob.

Personally, I don't really care. I can deliver the code for either one,
there's not that much of a difference as far as the implementation is
concerned. I'll start a thread on django-developers@ in the upcoming weeks
regarding the status of this project and my plans, that could be a good
opportunity for you to bring this up. Just keep in mind that this feature
has a history of attracting lots of bikeshedding discussions while the
more serious architectural issues are mostly being ignored. To me, this
smells more like the former. So, whatever the final decision on django-
developers@ is, I'll just accept it and write it that way.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:115>

Django

unread,
Feb 26, 2013, 7:10:20 PM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by jeremyt):

Yeah.. the ideas on this have been plentiful as shown by that thread. The
optional primary_key Meta option definitely goes with the DRY principle
that Django is based upon but as long as the scenario is enabled, then I'm
ok with spelling it out every time.

This patch plus the work I've done on multi-column joins
[https://code.djangoproject.com/ticket/19385] should open up some major
use cases. I lend a helping hand to this issue, as well, to handle any
concerns.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:116>

Django

unread,
Feb 26, 2013, 9:27:53 PM2/26/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by skizzay):

Jeremy makes a good point about placing primary_key as a constraint within
Meta. However, for the interest of time IMO, sticking with the current
plan is the best path. Adding primary_key to Meta later as an
afterthought (assuming the rest of the community finds a need for it)
should be simple enough without breaking (future) existing code.

What is the difference between the auxillary_fk_fields and soc2011
/composite-fields branches? How often is master merged? Obviously, this
isn't a simple change. Maybe the community could help out a little if
they had some status of what they could do to help.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:117>

Django

unread,
Apr 9, 2013, 4:49:31 AM4/9/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koniiiik):

I apologize for the lack of timely response.

#19385 looks like it implements the last big piece that is missing from my
work. I'll need to have a more thorough look at it though.

The current status of my work is kinda sad. The repo is badly out of date
because it has become a real pain to keep it in sync with master. I won't
get into much detail about why here, but I think it isn't worth the effort
to try to sync it up. Basically, the problem is that I first implemented
`CompositeField` (in branch `soc2011/composite-fields`) without
`ForeignKey` support and then I started to refactor `ForeignKey` on top of
that (`auxiliary_fk_fields`). This has become a real nightmare to
maintain. I managed to get the branches through the initial Py3k changes
but that required carefully merging each upstream commit one by one, after
that there were numerous cleanups in the ORM which I didn't get around to
merging.

However, that doesn't mean I'm giving up, I've got other plans. The idea
is to do it the other way around, first refactor `ForeignKey` and only
after it works with simple fields, port `CompositeField` on top of it.
This should still make it possible to reuse most of the code I wrote
throughout the past two years and make the changes easier to follow.

I'd like to apply for the upcoming Google Summer of Code with this to
finally put this to rest, so keep an eye out on django-developers@ for an
email in the near future.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:118>

Django

unread,
Oct 3, 2013, 9:02:03 AM10/3/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by lars@…):

* cc: lars@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:119>

Django

unread,
Oct 6, 2013, 9:27:21 AM10/6/13
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: database | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by trbs):

* cc: trbs@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:120>

Django

unread,
Jan 26, 2015, 11:16:54 AM1/26/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:121>

Django

unread,
Jan 30, 2015, 3:05:12 AM1/30/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ar45):

* cc: ar45 (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:122>

Django

unread,
Mar 5, 2015, 6:25:34 AM3/5/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nattster):

* cc: nattster (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:123>

Django

unread,
Sep 25, 2015, 12:54:52 AM9/25/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by toracle):

* cc: toracle@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:124>

Django

unread,
Oct 1, 2015, 4:43:44 AM10/1/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by auvipy):

these are the draft dep to implement composite primary key on django orm

https://github.com/django/deps/blob/master/draft/0191-composite-fields.rst

and

https://github.com/django/deps/blob/master/draft/0192-standalone-
composite-fields.rst

anyone interested to completed this feature could have some look on them.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:125>

Django

unread,
Nov 25, 2015, 5:53:46 AM11/25/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by auvipy):

for any one interested

https://github.com/django/django/pull/4553

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:126>

Django

unread,
Nov 25, 2015, 6:07:04 AM11/25/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version: master

(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by auvipy):

* version: => master


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:127>

Django

unread,
Nov 25, 2015, 7:06:01 AM11/25/15
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: jacob | Owner: koniiiik
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by guettli):

* cc: hv@… (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:128>

Django

unread,
Jan 12, 2017, 9:54:09 AM1/12/17
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Asif Saifuddin Auvi):

As per conversation in IRC the existing Deps should also be revised based
on other works and also https://gist.github.com/koniiiik/5408673

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:129>

Django

unread,
Jan 12, 2017, 10:03:08 AM1/12/17
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Asif Saifuddin Auvi):

https://code.djangoproject.com/ticket/16508 could be related

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:130>

Django

unread,
Apr 9, 2017, 5:56:55 PM4/9/17
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Fernando Gutiérrez):

* cc: zerks0@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:131>

Django

unread,
May 19, 2017, 7:09:15 PM5/19/17
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Schuyler Duveen):

* cc: sky@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:132>

Django

unread,
Jul 24, 2017, 8:08:25 AM7/24/17
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

* cc: David Sanders (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:133>

Django

unread,
Jan 27, 2019, 9:10:22 PM1/27/19
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Solomon Ucko):

* cc: Solomon Ucko (added)


Comment:

It's been about 13 years since this issue was created and about 8 years
since work on it has begun, and it ''still'' hasn't been implemented! Does
the basic functionality at least work? FWIW, AFAIK the main motivation for
this feature is "relationship tables" (i.e. ones that link 2 or more
tables together), which is relatively common. Also, a better API might be
allowing `primary_key` to be set on multiple fields. For my use case, I
don't need to reference the set of columns directly from the database,
just in the view logic. (The item specified by the URL and the current
user are my two primary keys.) I could just use `unique_together`, but I'd
rather not unnecessarily add an extra column. It's not that much of a
problem, but I'd prefer not to need to.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:134>

Django

unread,
Feb 18, 2019, 11:03:51 AM2/18/19
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michal
| Petrucha
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Golan Bar):

* cc: Golan Bar (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:135>

Django

unread,
Mar 8, 2019, 1:13:28 AM3/8/19
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Asif Saifuddin Auvi):

* owner: Michal Petrucha => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:136>

Django

unread,
Jul 6, 2019, 9:30:46 AM7/6/19
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: nomad5000

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nomad5000):

* owner: (none) => nomad5000
* status: new => assigned
* cc: nomad5000 (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:137>

Django

unread,
Dec 1, 2020, 12:51:15 AM12/1/20
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Damien):

* cc: Damien (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:138>

Django

unread,
Dec 22, 2020, 1:18:50 PM12/22/20
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by t0mm1e):

* cc: t0mm1e (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:139>

Django

unread,
Jul 21, 2021, 12:47:10 PM7/21/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev

(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexandr Artemyev):

* cc: Alexandr Artemyev (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:140>

Django

unread,
Jul 21, 2021, 12:47:59 PM7/21/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexandr Artemyev):

* cc: Alexandr Artemyev (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:141>

Django

unread,
Jul 21, 2021, 12:48:19 PM7/21/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexandr Artemyev):

* cc: Alexandr Artemyev (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:142>

Django

unread,
Aug 9, 2021, 5:53:39 PM8/9/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Charlie Denton):

* cc: Charlie Denton (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:143>

Django

unread,
Aug 11, 2021, 6:12:01 AM8/11/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Thomas van Gulick):

* cc: Thomas van Gulick (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:144>

Django

unread,
Aug 11, 2021, 12:12:29 PM8/11/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Fogel):

* cc: Mike Fogel (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:145>

Django

unread,
Aug 11, 2021, 12:42:47 PM8/11/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Michael
| Schmidt
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Aron Podrigal):

* cc: Aron Podrigal (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:146>

Django

unread,
Oct 19, 2021, 6:18:47 AM10/19/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)

Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Michael Schmidt => (none)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:147>

Django

unread,
Oct 19, 2021, 6:18:54 AM10/19/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new

Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:148>

Django

unread,
Dec 17, 2021, 4:30:00 PM12/17/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Peter Thomassen):

* cc: Peter Thomassen (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:149>

Django

unread,
Dec 22, 2021, 4:56:46 AM12/22/21
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: raydeal

Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by raydeal):

* cc: raydeal (added)
* owner: (none) => raydeal


* status: new => assigned


Comment:

I would like to dive into this issue and see how can I help.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:150>

Django

unread,
Jan 7, 2022, 1:55:42 AM1/7/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: raydeal
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by אורי):

* cc: אורי (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:151>

Django

unread,
Jan 14, 2022, 11:39:29 AM1/14/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: raydeal
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by raydeal):

I am digging in Dj ORM code and trying understand how FK works underneath.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:152>

Django

unread,
Jan 26, 2022, 5:39:28 AM1/26/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by raydeal):

* owner: raydeal => (none)


* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:153>

Django

unread,
Feb 16, 2022, 2:05:22 AM2/16/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by elonzh):

* cc: elonzh (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:154>

Django

unread,
Sep 20, 2022, 12:19:36 AM9/20/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by clouds56):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/16075

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:155>

Django

unread,
Sep 20, 2022, 2:14:58 AM9/20/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds

Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: (none) => Clouds
* needs_better_patch: 0 => 1


* status: new => assigned

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:156>

Django

unread,
Sep 22, 2022, 6:57:21 AM9/22/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Clouds):

Hello, the main work of CompoisteField has been done and I'm now working
on `primary_together`/`PrimaryKeyConstraint`.
While I've got several questions:

1. How to write test for migration? (or witch existing test as example)
a. test if the model generating correct models.State
b. test if from OldModel to NewModel would success migrated
2. Shall we have PrimaryKeyConstraint and CompositeField in one PR?
a. primary (without multicolumn) first, then composite
b. composite (cannot set as PK) first, then primary

The main blocker split it into 2 PR might be hard to add meaningful tests
in first PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:157>

Django

unread,
Dec 29, 2022, 8:31:02 PM12/29/22
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Lily Foote):

* cc: Lily Foote (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:158>

Django

unread,
Apr 6, 2023, 8:55:17 AM4/6/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Wilson E. Husin):

* cc: Wilson E. Husin (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:159>

Django

unread,
May 16, 2023, 2:51:08 PM5/16/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by appuchias):

* cc: appuchias (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:160>

Django

unread,
May 16, 2023, 3:28:07 PM5/16/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Appuchia):

* cc: Appuchia (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:161>

Django

unread,
Jun 2, 2023, 10:12:40 AM6/2/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

* cc: bmispelon@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:162>

Django

unread,
Jun 2, 2023, 10:15:27 AM6/2/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

* cc: bmispelon@… (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:163>

Django

unread,
Jun 2, 2023, 10:17:17 AM6/2/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

* cc: Baptiste Mispelon (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:164>

Django

unread,
Jun 2, 2023, 10:17:33 AM6/2/23
to django-...@googlegroups.com
#373: Add support for multiple-column primary keys
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: Clouds
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: database | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

* cc: Baptiste Mispelon (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/373#comment:165>

Reply all
Reply to author
Forward
0 new messages