mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-01-21 07:42:58 -05:00
feat: approve users, edit users through manage users page (#1383)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import User
|
||||
@@ -5,20 +6,7 @@ from .models import User
|
||||
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
search_fields = ["email", "username", "name"]
|
||||
exclude = (
|
||||
"user_permissions",
|
||||
"title",
|
||||
"password",
|
||||
"groups",
|
||||
"last_login",
|
||||
"is_featured",
|
||||
"location",
|
||||
"first_name",
|
||||
"last_name",
|
||||
"media_count",
|
||||
"date_joined",
|
||||
"is_active",
|
||||
)
|
||||
exclude = ["user_permissions", "title", "password", "groups", "last_login", "is_featured", "location", "first_name", "last_name", "media_count", "date_joined", "is_active", "is_approved"]
|
||||
list_display = [
|
||||
"username",
|
||||
"name",
|
||||
@@ -33,5 +21,10 @@ class UserAdmin(admin.ModelAdmin):
|
||||
list_filter = ["is_superuser", "is_editor", "is_manager"]
|
||||
ordering = ("-date_added",)
|
||||
|
||||
if settings.USERS_NEEDS_TO_BE_APPROVED:
|
||||
list_display.append("is_approved")
|
||||
list_filter.append("is_approved")
|
||||
exclude.remove("is_approved")
|
||||
|
||||
|
||||
admin.site.register(User, UserAdmin)
|
||||
|
||||
Reference in New Issue
Block a user