Skip to content

Conversation

JaeHyuckSa
Copy link
Contributor

@JaeHyuckSa JaeHyuckSa commented Aug 23, 2025

Trac ticket number

ticket-36187

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Copy link
Member

@cliff688 cliff688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JaeHyuckSa for picking this up!

I left some comments inline; let me know what you think

@JaeHyuckSa JaeHyuckSa force-pushed the issue-36187 branch 3 times, most recently from 19b1109 to 425e743 Compare August 25, 2025 16:14
Copy link
Member

@cliff688 cliff688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍🏾 @JaeHyuckSa for the updates!

@JaeHyuckSa JaeHyuckSa force-pushed the issue-36187 branch 4 times, most recently from a17ae6c to 2ea01e6 Compare September 1, 2025 16:47
Copy link
Member

@cliff688 cliff688 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JaeHyuckSa 👍 I think this is really close.

_("No %(verbose_name)s found matching the query")
% {"verbose_name": queryset.model._meta.verbose_name}
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A merger or someone will tell if we need to update the error on L64 to mention primary key fields.

For models with a composite primary key, ``get_object()`` will
look for all primary key field names (as defined in ``pk_fields``)
in the keyword arguments. If all are present, it performs a get
lookup with those values. If any are missing, it returns a 404.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only returns a 404 if the pk_fields are all present but the lookup does not return an object. If they aren't, it raises an attribute error, the one mentioned in my previous comment.

Additionally, please add an :attr: ref to pk_fiekds

an example.


Composite primary keys with Class-Based Views
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Composite primary keys with Class-Based Views
Models with composite primary keys

(Maybe. Also, use sentence-casw for headings)


All field names from :attr:`~django.db.models.options.Options.pk_fields`
must be present as URL parameters. No comma separators or specific ordering
required.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a paragraph break, here

required.

In other words, the following URLconfs would have worked as well when
fetching composite-pk models:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to have two colons ::

In other words, the following URLconfs would have worked as well when
fetching composite-pk models:

path("item/<int:product_id>/<str:order_id>/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as what we used in the example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants