Re: [Django] #11265: ForeignKey/OneToOneField should support user-defined id attribute name

2 views
Skip to first unread message

Django

unread,
Jan 26, 2015, 1:15:44 PM1/26/15
to django-...@googlegroups.com
#11265: ForeignKey/OneToOneField should support user-defined id attribute name
-------------------------------------+-------------------------------------
Reporter: dstora | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: foreign key | Triage Stage: Accepted
ForeignKey OneToOneField id |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)


Comment:

We're moving in the direction of having two distinct fields here. One
that's simply an "id" field, and one that's the ForeignKey. This would
control the name of the underlying field.

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

Django

unread,
Feb 13, 2023, 5:14:37 AM2/13/23
to django-...@googlegroups.com
#11265: ForeignKey/OneToOneField should support user-defined id attribute name
-------------------------------------+-------------------------------------
Reporter: dstora | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: foreign key | Triage Stage: Accepted
ForeignKey OneToOneField id |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by elonzh):

* cc: elonzh (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/11265#comment:9>

Django

unread,
Feb 13, 2023, 5:39:03 AM2/13/23
to django-...@googlegroups.com
#11265: ForeignKey/OneToOneField should support user-defined id attribute name
-------------------------------------+-------------------------------------
Reporter: dstora | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: foreign key | Triage Stage: Accepted
ForeignKey OneToOneField id |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by elonzh):

This is funny, I have a model `Biblio` with a `issn` field, someday I
created a new model `IssnIndexedData` with `issn` as primary key.

I want to join `IssnIndexedData` but it can not be done unless I add a
logic Foreignkey `issn_indexed_data` with `db_column="issn"` to `Biblio`.
(See https://code.djangoproject.com/ticket/29262)

Fine, I just make a fake migration to make Django happy.

But wait! The `attname` is hard coded and I can't use `Biblio.issn`
anymore...

--
Ticket URL: <https://code.djangoproject.com/ticket/11265#comment:10>

Reply all
Reply to author
Forward
0 new messages