Coverage for accounts/admin.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-13 16:37 -0700

1from django.contrib import admin 

2from django.contrib.auth import get_user_model 

3from django.contrib.auth.admin import UserAdmin 

4 

5from .forms import CustomUserChangeForm, CustomUserCreationForm 

6 

7User = get_user_model() 

8 

9 

10@admin.register(User) 

11class CustomUserAdmin(UserAdmin): 

12 add_form = CustomUserCreationForm 

13 form = CustomUserChangeForm 

14 model = User 

15 list_display = [ 

16 "email", 

17 "username", 

18 "is_staff", 

19 ] 

20 fieldsets = ( 

21 (None, {"fields": ("username", "password")}), 

22 ( 

23 "Personal information", 

24 { 

25 "fields": ( 

26 "first_name", 

27 "last_name", 

28 "email", 

29 "age", 

30 "country", 

31 "profile_pic", 

32 "bio", 

33 ) 

34 }, 

35 ), 

36 ( 

37 "Permissions", 

38 { 

39 "fields": ( 

40 "is_active", 

41 "is_staff", 

42 "is_superuser", 

43 "groups", 

44 "user_permissions", 

45 ) 

46 }, 

47 ), 

48 ("Important dates", {"fields": ("last_login", "date_joined")}), 

49 )