diff --git a/shipanaro/admin.py b/shipanaro/admin.py index 2085923..2523c8b 100644 --- a/shipanaro/admin.py +++ b/shipanaro/admin.py @@ -81,26 +81,27 @@ class MembershipAdmin(ShipanaroModelAdmin): list_display = ( "uid", "activated", + "drop_out", "user__first_name", "user__last_name", "user__username", "user__email", + "nid", + "ldap_dn", "birthday", # 'assigned_sex', "gender", - "phone", + # "phone", # 'phone_2', - # 'user__date_joined', - # 'date_left', - "nid", # 'nid_type', "province", - "city", + # "city", # 'address', # 'nationality', # 'notes', - "postal_code", - "drop_out", + # "postal_code", + "user__date_joined", + "date_left", ) ordering = ("-uid",) list_filter = ( diff --git a/shipanaro/models.py b/shipanaro/models.py index f70cdbf..996690c 100644 --- a/shipanaro/models.py +++ b/shipanaro/models.py @@ -9,6 +9,7 @@ from django.utils.translation import gettext as _ from shipanaro import settings from shipanaro.auth.models import User, Group +from humans.directory import Directory # Based on ISO 5218 SEXES = ( @@ -142,6 +143,12 @@ def save(self, *args, **kwargs): def __str__(self): return self.user.first_name + @property + def ldap_dn(self): + directory = Directory() + dn, attrs = directory.get_user(self.user.username) + return dn if attrs else None + SUBSCRIPTION_SERVICES = (("newsletter", _("Newsletter")),)