-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️Feat: 외부 필터파일 생성 및 order_by 코드 리팩토링 #9
- Loading branch information
1 parent
64d2786
commit c92ac69
Showing
2 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import django_filters | ||
|
||
from .models import Post | ||
|
||
|
||
class PostFilter(django_filters.FilterSet): | ||
ordering = django_filters.OrderingFilter( | ||
fields=( | ||
("created_at", "created_at"), | ||
("updated_at", "updated_at"), | ||
("view_count", "view_count"), | ||
("share_count", "share_count"), | ||
("like_count", "like_count"), | ||
), | ||
field_name="ordering", | ||
help_text="정렬 기준과 방향 (예: created_at:desc)", | ||
) | ||
|
||
class Meta: | ||
model = Post | ||
fields = ["ordering"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters