#36075: Field.primary_key documentation should details its interaction with
CompositePrimaryKey
-------------------------------------+-------------------------------------
     Reporter:  Simon Charette       |                    Owner:  (none)
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Documentation        |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Simon Charette:

Old description:

> A particular focus should be put on the fact that the flag will and
> should only be set to `True` if the field is the single member of the
> primary key. When a composite primary is defined on the model this flag
> will be `False` for all the fields defined on the model and
> `_meta.pk_fields` (which should be documented) should be used instead to
> build composite primary key ready third-party application.
>
> In other words, it should be made clear that code that relies solely on
> `Field.primary_key` is not composite primary key ready and that
> `_meta.pk_fields` should be used instead.

New description:

 A particular focus should be put on the fact that the flag will and should
 only be set to `True` if the field is the single member of the primary
 key. When a composite primary is defined on the model this flag will be
 `False` for all the fields defined on the model and `_meta.pk_fields`
 (which should be documented) should be used instead to build composite
 primary key ready third-party application.

 In other words, it should be made clear that code that relies solely on
 `Field.primary_key` is not composite primary key ready and that
 `_meta.pk_fields` should be used instead. I feel like this is something
 that should be clearly pointed out in the release notes as well.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070194499faa37-60f3a513-ba01-4112-82c0-690c5ea93266-000000%40eu-central-1.amazonses.com.

Reply via email to