#36351: CompositePrimaryKey fails in InlineAdmins with a JSONDecodeError
-------------------------------+--------------------------------------
     Reporter:  Dominik Bruhn  |                    Owner:  (none)
         Type:  Uncategorized  |                   Status:  closed
    Component:  Uncategorized  |                  Version:  5.2
     Severity:  Normal         |               Resolution:  duplicate
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Comment (by Natalia Bidart):

 Hello Dominik Bruhn, thank you for the ticket. I think there are a couple
 of points to consider:
 1. As Simon mentioned, composite primary keys are not yet supported in the
 admin.
 2. Looking at your models (I understand they’re a simplification), it
 appears the composite primary key is being used primarily as a unique
 constraint. If that's the case, even with more complex models, composite
 primary keys may not be the best fit. Django provides robust tools for
 defining various constraints that are often more appropriate and better
 supported.

 If you haven’t already, I recommend reading
 [https://csirmazbendeguz.github.io/2025/04/15/you-dont-need-composite-
 primary-keys.html this blog post by one of the composite PK feature
 authors], it offers helpful perspective on when composite primary keys are
 (and aren't) the right tool.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36351#comment:3>
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/010701966835bac5-739425d9-3d6c-4d66-89a5-cec71ae6e137-000000%40eu-central-1.amazonses.com.

Reply via email to