Merge branch 'kerl/rm_login_clipper' into 'master'

Admin : supprime la colonne login_clipper dans la liste des Users

See merge request klub-dev-ens/gestioCOF!486
This commit is contained in:
Ludovic Stephan 2021-02-18 17:01:05 +01:00
commit 71fbbcff8a

View file

@ -100,28 +100,6 @@ class CofProfileInline(admin.StackedInline):
inline_classes = ("collapse open",) inline_classes = ("collapse open",)
class FkeyLookup(object):
def __init__(self, fkeydecl, short_description=None, admin_order_field=None):
self.fk, fkattrs = fkeydecl.split("__", 1)
self.fkattrs = fkattrs.split("__")
self.short_description = short_description or self.fkattrs[-1]
self.admin_order_field = admin_order_field or fkeydecl
def __get__(self, obj, klass):
if obj is None:
"""
hack required to make Django validate (if obj is
None, then we're a class, and classes are callable
<wink>)
"""
return self
item = getattr(obj, self.fk)
for attr in self.fkattrs:
item = getattr(item, attr)
return item
def ProfileInfo(field, short_description, boolean=False): def ProfileInfo(field, short_description, boolean=False):
def getter(self): def getter(self):
try: try:
@ -134,7 +112,6 @@ def ProfileInfo(field, short_description, boolean=False):
return getter return getter
User.profile_login_clipper = FkeyLookup("profile__login_clipper", "Login clipper")
User.profile_phone = ProfileInfo("phone", "Téléphone") User.profile_phone = ProfileInfo("phone", "Téléphone")
User.profile_occupation = ProfileInfo("occupation", "Occupation") User.profile_occupation = ProfileInfo("occupation", "Occupation")
User.profile_departement = ProfileInfo("departement", "Departement") User.profile_departement = ProfileInfo("departement", "Departement")
@ -163,7 +140,6 @@ class UserProfileAdmin(UserAdmin):
is_cof.boolean = True is_cof.boolean = True
list_display = UserAdmin.list_display + ( list_display = UserAdmin.list_display + (
"profile_login_clipper",
"profile_phone", "profile_phone",
"profile_occupation", "profile_occupation",
"profile_mailing_cof", "profile_mailing_cof",