#36267: content_type.views.shortcut throws exception handling invalid UUID
(View on
Site in admin)
--------------------------+------------------------------------------------
Reporter: ashapiro | Type: Uncategorized
Status: new | Component: contrib.contenttypes
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+------------------------------------------------
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
[https://github.com/django/django/blob/955b7c6ba105b328f387a9d63540dbabd4a05828/django/contrib/contenttypes/views.py#L21
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36267>
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/01070195b1888c70-de080f68-a06d-49f9-96c8-8400e68ca667-000000%40eu-central-1.amazonses.com.