simonw / django-sql-dashboard

Django app for building dashboards using raw SQL queries
https://django-sql-dashboard.datasette.io/
Apache License 2.0
437 stars 37 forks source link

Make owned_by an autocomplete field in the Django admin. #121

Closed toolness closed 3 years ago

toolness commented 3 years ago

Currently the owned_by field lists a user primary key:

image

Changing this requires the admin user to click the magnifying glass, at which point a new popup opens which allows them to search for users.

In contrast, this PR changes the field to be defined via ModelAdmin.autocomplete_fields so it's a bit easier to change:

image

That said, I'm now realizing that one downside of this approach is that there's no way to get more information about the selected user. With the other approach, clicking on "varma" takes you to the Django change view for that user, so that if you have any doubts, it's easy to see who the record is really pointing at. So I won't be offended if you decide to close this PR without merging!

simonw commented 3 years ago

Yeah I think I'll keep this as-is so that there's a link through to the full user profile. It would be great if the Django autocomplete field included these links!