Skip to content

Commit

Permalink
Use slug for board detail lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
injoonH committed Jul 21, 2023
1 parent e01792d commit 92de15c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 20 additions & 0 deletions apps/core/migrations/0052_alter_board_slug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.3 on 2023-07-21 04:48

from django.db import migrations
import django_extensions.db.fields


class Migration(migrations.Migration):
dependencies = [
("core", "0051_remove_board_en_description_and_more"),
]

operations = [
migrations.AlterField(
model_name="board",
name="slug",
field=django_extensions.db.fields.AutoSlugField(
blank=True, editable=False, populate_from=["en_name"], unique=True
),
),
]
5 changes: 2 additions & 3 deletions apps/core/models/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class BoardAccessPermissionType(IntEnum):

class Board(MetaDataModel):
slug = AutoSlugField(
populate_from=[
"en_name",
],
populate_from=["en_name"],
unique=True,
)
ko_name = models.CharField(
verbose_name="게시판 국문 이름",
Expand Down
1 change: 1 addition & 0 deletions apps/core/views/viewsets/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ class BoardViewSet(viewsets.ReadOnlyModelViewSet, ActionAPIViewSet):
action_serializer_class = {
"list": BoardDetailActionSerializer,
}
lookup_field = "slug"

0 comments on commit 92de15c

Please sign in to comment.