diff --git a/gestioncof/admin.py b/gestioncof/admin.py index 768cff3b..89e4160d 100644 --- a/gestioncof/admin.py +++ b/gestioncof/admin.py @@ -100,28 +100,6 @@ class CofProfileInline(admin.StackedInline): 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 - ) - """ - 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 getter(self): try: @@ -134,7 +112,6 @@ def ProfileInfo(field, short_description, boolean=False): return getter -User.profile_login_clipper = FkeyLookup("profile__login_clipper", "Login clipper") User.profile_phone = ProfileInfo("phone", "Téléphone") User.profile_occupation = ProfileInfo("occupation", "Occupation") User.profile_departement = ProfileInfo("departement", "Departement") @@ -163,7 +140,6 @@ class UserProfileAdmin(UserAdmin): is_cof.boolean = True list_display = UserAdmin.list_display + ( - "profile_login_clipper", "profile_phone", "profile_occupation", "profile_mailing_cof",