widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11253
[Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
kaputtnik has proposed merging lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/custom_user_admin_page/+merge/331613
Since i deleted two users today i got bored with the admin page showing all users in a list, sorted by username. Everytime one has to search for the user he wants to delete, while the most time a spammer has registered within the last few days. So i thought to order the list by 'date_joined' and made some other changes to make the work a bit easier:
Removed columns: 'last_name' and 'first_name'
Added columns: 'date_joined', 'last_login' and 'is_active'
Ordering is changed from 'username' to 'date_joined' showing the recent joined users first
All columns are sortable.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website.
=== modified file 'wlprofile/admin.py'
--- wlprofile/admin.py 2016-12-13 18:28:51 +0000
+++ wlprofile/admin.py 2017-09-30 11:48:04 +0000
@@ -12,6 +12,8 @@
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from models import Profile
+from django.contrib.auth.models import User
+from django.contrib.auth.admin import UserAdmin
class ProfileAdmin(admin.ModelAdmin):
@@ -37,3 +39,18 @@
)
admin.site.register(Profile, ProfileAdmin)
+
+
+class CustomUserAdmin(UserAdmin):
+ """Partly overwritten admin page for django auth.user.
+
+ Replaces in users list: 'first_name' with 'date_joined' and
+ 'last_name' with 'is_active'. Added column: 'last_login'.
+
+ """
+ list_display = ('username', 'email', 'date_joined', 'last_login',
+ 'is_active', 'is_staff')
+ ordering = ('-date_joined',)
+
+admin.site.unregister(User)
+admin.site.register(User, CustomUserAdmin)
Follow ups
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-17
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: kaputtnik, 2017-10-15
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-15
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-15
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: kaputtnik, 2017-10-14
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-14
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: kaputtnik, 2017-10-13
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-05
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: kaputtnik, 2017-10-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: kaputtnik, 2017-10-04
-
[Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: noreply, 2017-10-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/custom_user_admin_page into lp:widelands-website
From: GunChleoc, 2017-10-04