# Admin User last\_login as readonly

**URL:** <https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393>\
**Category:** Using Django\
**Created:** [May 13, 2020, 12:02am UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393 "2020-05-13T00:02:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![llass61](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/llass61/32/725_2.png) [@llass61](https://forum.djangoproject.com/u/llass61)\
**Post date:** [May 13, 2020, 12:02am UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/1 "2020-05-13T00:02:41Z")

</div>

Pretty new to django. I am on 1.11 version.  
I would like to modify the default User Admin form so that the last\_login and date\_joined fields are readonly for a user. How do you do that?

---

<div class="post-metadata">

**Author:** ![jlgimeno](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlgimeno/32/284_2.png) [@jlgimeno](https://forum.djangoproject.com/u/jlgimeno)\
**Post date:** [May 13, 2020, 4:25am UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/2 "2020-05-13T04:25:36Z")

</div>

I’ve never had to do that before. Just browsing through the (very thorough!) admin page documentation, I found this a good place to start experimenting: [https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly\_fields](https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields)

-Jorge

---

<div class="post-metadata">

**Author:** ![llass61](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/llass61/32/725_2.png) [@llass61](https://forum.djangoproject.com/u/llass61)\
**Post date:** [May 13, 2020, 1:03pm UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/3 "2020-05-13T13:03:09Z")

</div>

I already reviewed the documentation. It shows how to make them readonly if your creating a new admin table/model. Not sure how to change the existing (default) User model.

Thanks for the suggestion though!

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 13, 2020, 2:34pm UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/4 "2020-05-13T14:34:07Z")

</div>

If you’re looking to change the Admin page for the User model, you’ll need to unregister the existing Admin form and register with your version:

```auto
admin.site.unregister(User)
admin.site.register(User, CustomUserAdmin)

```

From there, you can define your own [CustomUserAdmin Form](https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#extending-the-existing-user-model) defining fields however you need them to be.

Ken

---

<div class="post-metadata">

**Author:** ![llass61](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/llass61/32/725_2.png) [@llass61](https://forum.djangoproject.com/u/llass61)\
**Post date:** [May 13, 2020, 5:17pm UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/5 "2020-05-13T17:17:03Z")

</div>

Do I have to recreate all the fields already in the default User model? I really just want to use the default model, but add:  
`readonly_fields = ['last_login'] `

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 13, 2020, 7:27pm UTC](https://forum.djangoproject.com/t/admin-user-last-login-as-readonly/2393/6 "2020-05-13T19:27:40Z")

</div>

My guess would be no.

You could import the existing UserAdmin class, and make your CustomUserAdmin inherit from it - and then specify your readonly\_fields for your CustomUserAdmin class.
