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)
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp