Showing only current user in Django admin

8 views
Skip to first unread message

Simon Connah

unread,
Mar 17, 2018, 5:47:50 AM3/17/18
to django...@googlegroups.com
I'm just making my first Django app in a very long time, and I have forgotten most of what I learnt. I'm using the built-in admin panel for ease of use, and it seems to be working well, with one exception.

I have a BlogPost model with the usual things in it. One of the fields is a FK to the User object called Author. When I display that model in the admin panel, it shows a drop-down list where you can select which one of the currently registered users should be the author.

What I'd rather happen is that it only shows the currently logged in user, with no option to choose a different user.

On a slightly related noted I also have a CharField in the model and the admin centre this is displayed as a small HTML text field which isn't big enough (the CharField is max_length=512). I've done some Googling but can't find a reasonable way to easily change the admin panel widgets.

Sorry if these questions are stupid. It has been a very long time since I last used Django and if memory serves, I never used the built-in admin panel at all.

Thank you for any help.

Simon.
Reply all
Reply to author
Forward
0 new messages