Skip to content

Commit 387ecef

Browse files
committed
update: ADMIN에 프로필사진, 소개글 필드 추가
1 parent 30c9b60 commit 387ecef

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

account/migrations/__init__.py

Whitespace-only changes.

accounts/admin.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django.contrib import admin
2+
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
3+
from django.contrib.auth.models import User
4+
5+
from accounts.models import UserExt
6+
7+
8+
# Define an inline admin descriptor for Employee model
9+
# which acts a bit like a singleton
10+
class UserExtInline(admin.StackedInline):
11+
model = UserExt
12+
can_delete = False
13+
verbose_name_plural = "UserExt"
14+
15+
16+
# Define a new User admin
17+
class UserAdmin(BaseUserAdmin):
18+
inlines = [UserExtInline]
19+
20+
21+
# Re-register UserAdmin
22+
admin.site.unregister(User)
23+
admin.site.register(User, UserAdmin)

accounts/migrations/0001_initial.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Generated by Django 4.1.5 on 2023-06-20 12:19
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name="UserExt",
19+
fields=[
20+
(
21+
"id",
22+
models.BigAutoField(
23+
auto_created=True,
24+
primary_key=True,
25+
serialize=False,
26+
verbose_name="ID",
27+
),
28+
),
29+
("profile_img", models.ImageField(blank=True, null=True, upload_to="")),
30+
("bio", models.TextField()),
31+
(
32+
"user",
33+
models.OneToOneField(
34+
on_delete=django.db.models.deletion.CASCADE,
35+
to=settings.AUTH_USER_MODEL,
36+
),
37+
),
38+
],
39+
),
40+
]

0 commit comments

Comments
 (0)