From f09817a325c639b2d2e7facab02e9c4e08e75bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Wed, 29 Dec 2021 21:08:38 +0100 Subject: [PATCH] Hide the password field --- src/paperless_mail/admin.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/paperless_mail/admin.py b/src/paperless_mail/admin.py index 0c7e01ab8..0d392f90b 100644 --- a/src/paperless_mail/admin.py +++ b/src/paperless_mail/admin.py @@ -1,9 +1,25 @@ from django.contrib import admin +from django import forms from paperless_mail.models import MailAccount, MailRule from django.utils.translation import gettext_lazy as _ +class MailAccountAdminForm(forms.ModelForm): + + """Metadata classes uset in Django admin to display the form.""" + + class Meta: + + """Metadata class uset in Django admin to display the form.""" + + model = MailAccount + widgets = { + 'password': forms.PasswordInput(), + } + fields = '__all__' + + class MailAccountAdmin(admin.ModelAdmin): list_display = ("name", "imap_server", "username") @@ -19,6 +35,7 @@ class MailAccountAdmin(admin.ModelAdmin): 'fields': ['character_set'] }) ] + form = MailAccountAdminForm class MailRuleAdmin(admin.ModelAdmin):