#35953: Add composite PK admin support
-------------------------------------+-------------------------------------
Reporter: Csirmaz Bendegúz | Owner: Csirmaz
| Bendegúz
Type: New feature | Status: assigned
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Old description:
> This is a follow up to #373 (''CompositePrimaryKey'').
>
> My proposal is to separate the primary key fields with a comma e.g.
> `/admin/posts/post/foo,bar/change`.
>
> The comma is not escaped when used as a separator, but it is escaped
> (`%2C`) when part of the primary key's value.
> e.g. `pk = ("The,quick", "brown")` ->
> `/admin/posts/post/The%2Cquick,brown/change`
>
> According to [https://datatracker.ietf.org/doc/html/rfc3986 RFC 3986],
> unesacped commas are allowed in URI paths (as far as I understand).
>
> What if an existing, non-composite primary key contains a comma?
> ''While Django URL encodes commas in the admin URLs (see `QUOTE_MAP`), it
> must be able to look up objects by not-encoded PKs too.
> The solution is simple. We must check if the model the user is trying
> access has a composite primary key or not.''
>
> Since admin's `LogEntry` model uses ''"generic foreign keys"'', this
> ticket depends on #35941 (''composite GenericForeignKeys'').
New description:
This is a follow up to #373 (''CompositePrimaryKey'').
My proposal is to separate the primary key fields with a comma e.g.
`/admin/posts/post/foo,bar/change`.
The comma is not escaped when used as a separator, but it is escaped
(`%2C`) when part of the primary key's value.
e.g. `pk = ("The,quick", "brown")` ->
`/admin/posts/post/The%2Cquick,brown/change`
According to [https://datatracker.ietf.org/doc/html/rfc3986 RFC 3986],
unesacped commas are allowed in URI paths (as far as I understand).
What if an existing, non-composite primary key contains a comma?
''While Django URL encodes commas in the admin URLs (see `QUOTE_MAP`), it
must be able to look up objects by non-encoded PKs too (see #12349,
#18550).
The solution is simple. We must check if the model the user is trying
access has a composite primary key or not.''
Since admin's `LogEntry` model uses ''"generic foreign keys"'', this
ticket depends on #35941 (''composite GenericForeignKeys'').
--
Comment (by Csirmaz Bendegúz):
Yes that's correct, thanks Sarah
--
Ticket URL: <https://code.djangoproject.com/ticket/35953#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/0107019378906ea5-6e976d0e-cc2a-489d-b3b0-b99878c8d441-000000%40eu-central-1.amazonses.com.