Skip to content

Commit 5a5e49b

Browse files
committed
Merge pull request #173 from thaidn/thaidn-fix-165
Fix #165: Thêm dropdown cho [tình trạng] trong trang [Tình nguyện viên]
2 parents 9af3e51 + 5b586b8 commit 5a5e49b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

project/app/admin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class Media:
167167
class TinhNguyenVienAdmin(admin.ModelAdmin):
168168
list_display = ('name', 'location', 'phone', 'status')
169169
list_filter = (
170-
'status',
170+
('status', ChoiceDropdownFilter),
171171
TinhAdminFilter,
172172
HuyenAdminFilter,
173173
XaAdminFilter,
@@ -178,7 +178,9 @@ class TinhNguyenVienAdmin(admin.ModelAdmin):
178178

179179
def get_queryset(self, request):
180180
queryset = super(TinhNguyenVienAdmin, self).get_queryset(request)
181-
queryset = queryset.prefetch_related('tinh', 'huyen', 'xa')
181+
queryset = queryset\
182+
.prefetch_related('tinh', 'huyen', 'xa')\
183+
.order_by('-status')
182184
return queryset
183185

184186

project/app/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
]
1818

1919
TINHNGUYEN_STATUS = [
20+
(0, 'Chưa xác minh'),
2021
(1, 'Sẵn sàng'),
2122
(2, 'Không gọi được'),
2223
(3, 'Đang nghỉ'),

0 commit comments

Comments
 (0)