diff --git a/tournaments/admin.py b/tournaments/admin.py index 92723eb..a868392 100644 --- a/tournaments/admin.py +++ b/tournaments/admin.py @@ -15,7 +15,7 @@ class CustomUserAdmin(UserAdmin): form = CustomUserChangeForm add_form = CustomUserCreationForm model = CustomUser - list_display = ['email', 'username', 'is_active', 'is_staff', 'first_name', 'last_name', 'date_joined'] + list_display = ['email', 'username', 'is_active', 'is_staff', 'first_name', 'last_name', 'date_joined', 'event_count'] fieldsets = [ (None, {'fields': ['id', 'username', 'email', 'password', 'first_name', 'last_name', 'is_active', 'clubs', 'country', 'phone', 'licence_id', 'umpire_code', diff --git a/tournaments/models/custom_user.py b/tournaments/models/custom_user.py index 5ade1d8..8f8f888 100644 --- a/tournaments/models/custom_user.py +++ b/tournaments/models/custom_user.py @@ -47,3 +47,6 @@ class CustomUser(AbstractUser): def discord_string(self): return f"{self.username} : {self.first_name} {self.last_name} | {self.email} | {self.phone}" + + def event_count(self): + return len(self.event_set.all())