Adherent admin

This commit is contained in:
Alexandre Iooss 2019-07-08 13:59:31 +02:00
parent 6ec6f96b41
commit c32dab80f8
No known key found for this signature in database
GPG key ID: 6C79278F3FCDCC02
5 changed files with 69 additions and 1 deletions

17
adherents/forms.py Normal file
View file

@ -0,0 +1,17 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.contrib.auth.forms import UserChangeForm
class CustomUserChangeForm(UserChangeForm):
"""
Make first name, last name and email required
in the default Django Auth User model
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['first_name'].required = True
self.fields['last_name'].required = True
self.fields['email'].required = True