Opened 2 days ago

Last modified 15 hours ago

#36267 assigned Bug

content_type.views.shortcut throws exception handling invalid UUID (View on Site in admin)

Reported by: Andy Shapiro Owned by: Ahmed Nassar
Component: contrib.contenttypes Version: 5.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a Django model with a UUID as a primary key. The model has a get_absolute_url implemented, which means in the Django admin, there is a “View on Site” button on the instance detail view.

A valid “View on Site” request looks like this: /admin/r/2/b6a283ce-0529-4ce6-8aa8-3aa5eba4f95b/, where the first parameter 2, is the content type ID, and the 2nd parameter is the UUID for a model instance. An invalid request looks like this: /admin/r/2/bad-uuid-that-will-not-validate/.

If an invalid UUID is passed to this view, the view will raise an unhandled ValidationError on this line .

Because this view is used in the admin application, it requires a staff member to access, so it cannot be thrown by a standard or unathenticated user.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • For anyone except the patch author to review the patch using the patch review checklist and either mark the ticket as "Ready for checkin" if everything looks good, or leave comments for improvement and mark the ticket as "Patch needs improvement".

Change History (4)

comment:1 by Andy Shapiro, 2 days ago

Type: UncategorizedBug

comment:2 by Clifford Gama, 45 hours ago

Triage Stage: UnreviewedAccepted

Replicated. Thanks for the report!

comment:3 by Ahmed Nassar, 42 hours ago

Owner: set to Ahmed Nassar
Status: newassigned

comment:4 by Ahmed Nassar, 15 hours ago

Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top