#29502: AutocompleteJsonView doesn't work if user has "view" but not "change"
-------------------------------------------+------------------------
Reporter: Matthew Frazier | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------------+------------------------
If a `ForeignKey` to a model is in `autocomplete_fields` and the user has
the `view` permission but not `change`, then the autocomplete field
doesn't work - the view returns 403 errors, and so the field shows "The
results could not be loaded." The value that was already on the model will
be retained when the model is saved, but if the model is new and the field
is required, this prevents the user from saving the model.
The fix is probably as simple as changing `has_change_permission` to
`has_view_permission` on
[[https://github.com/django/django/blob/d2ca28db54a5871d851cdd9184f4cf0d31aff946/django/contrib/admin/views/autocomplete.py#L52|line
52 of django/contrib/admin/views/autocomplete.py]]
--
Ticket URL: <https://code.djangoproject.com/ticket/29502>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.1eb1015c1ca65e7faed4ba11cc2de6cd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.