1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- from django.contrib import admin
- from django.contrib.auth.admin import UserAdmin as UA
- from django.utils.translation import gettext_lazy as _
- from .models import User, UserInstitution
- @admin.register(User)
- class UserAdmin(UA):
- fieldsets = (
- (None, {"fields": ("password",)}),
- (_("Personal info"), {"fields": ("first_name", "last_name", "email")}),
- (
- _("Permissions"),
- {
- "fields": (
- "is_active",
- "is_staff",
- "is_superuser",
- "groups",
- "user_permissions",
- ),
- },
- ),
- (_("Important dates"), {"fields": ("last_login", "date_joined")}),
- )
- add_fieldsets = (
- (
- None,
- {
- "classes": ("wide",),
- "fields": ("email", "password1", "password2"),
- },
- ),
- )
- list_display = ("email", "first_name", "last_name", "is_staff")
- ordering = ("-is_staff",)
- readonly_fields = ("last_login", "date_joined")
- @admin.register(UserInstitution)
- class UserInstitutionAdmin(admin.ModelAdmin):
- pass
|