Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1be3ad6

Browse files
committed
Add user admin
1 parent48b7714 commit1be3ad6

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

‎backend/main/admin.py‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
11
fromdjango.contribimportadmin
2+
fromdjango.contrib.auth.adminimportUserAdminasDjangoUserAdmin
3+
fromdjango.utils.translationimportugettext_lazyas_
24

3-
# Register your models here.
5+
frommain.modelsimportUser
6+
7+
8+
@admin.register(User)
9+
classUserAdmin(DjangoUserAdmin):
10+
"""Define admin model for custom User model with no email field."""
11+
12+
fieldsets= (
13+
(None, {"fields": ("email","password")}),
14+
(
15+
_("Permissions"),
16+
{
17+
"fields": (
18+
"is_active",
19+
"developer_mode",
20+
"is_staff",
21+
"is_superuser",
22+
)
23+
},
24+
),
25+
(_("Important dates"), {"fields": ("last_login","date_joined")}),
26+
)
27+
add_fieldsets= (
28+
(
29+
None,
30+
{
31+
"classes": ("wide",),
32+
"fields": (
33+
"email",
34+
"password1",
35+
"password2",
36+
"is_active",
37+
"is_staff",
38+
"is_superuser",
39+
),
40+
},
41+
),
42+
)
43+
list_display= ("email","last_login","date_joined")
44+
search_fields= ("email",)
45+
ordering= ("-date_joined",)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp