FEATURE(wallet): add DateTimeRangeFilter to panel admin
add DateTimeRangeFilter to panel admin
This commit is contained in:
parent
d9b7dbe1b2
commit
5eff037d10
4 changed files with 6 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import io
|
||||||
import xlsxwriter
|
import xlsxwriter
|
||||||
import jdatetime
|
import jdatetime
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from rangefilter.filters import DateTimeRangeFilter
|
||||||
# from utils.accounts_client import get_user_detailed_info
|
# from utils.accounts_client import get_user_detailed_info
|
||||||
|
|
||||||
@admin.action(description="export excel")
|
@admin.action(description="export excel")
|
||||||
|
|
@ -59,7 +60,7 @@ def export_excel(modeladmin, request, queryset):
|
||||||
class TransactionAdmin(admin.ModelAdmin):
|
class TransactionAdmin(admin.ModelAdmin):
|
||||||
list_display = ['uuid', 'application', 'splited_amount', 'jalali_datetime', 'payer', 'payer_type', 'payee', 'payee_type', 'state', 'amount', 'created_at', 'updated_at']
|
list_display = ['uuid', 'application', 'splited_amount', 'jalali_datetime', 'payer', 'payer_type', 'payee', 'payee_type', 'state', 'amount', 'created_at', 'updated_at']
|
||||||
search_fields = ['uuid', 'created_at', 'updated_at', 'payer_account__owner_uuid', 'payee_account__owner_uuid', 'application__uuid']
|
search_fields = ['uuid', 'created_at', 'updated_at', 'payer_account__owner_uuid', 'payee_account__owner_uuid', 'application__uuid']
|
||||||
list_filter = ['application', 'state']
|
list_filter = ['application', 'state', ('created_at', DateTimeRangeFilter),]
|
||||||
actions = [export_excel]
|
actions = [export_excel]
|
||||||
|
|
||||||
class AccountAdmin(admin.ModelAdmin):
|
class AccountAdmin(admin.ModelAdmin):
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ INSTALLED_APPS = [
|
||||||
'crispy_forms',
|
'crispy_forms',
|
||||||
'crispy_bootstrap5',
|
'crispy_bootstrap5',
|
||||||
'django_filters',
|
'django_filters',
|
||||||
|
'rangefilter',
|
||||||
# 'jalali_date',
|
# 'jalali_date',
|
||||||
|
|
||||||
# local apps
|
# local apps
|
||||||
|
|
|
||||||
|
|
@ -23,3 +23,4 @@ django-redis
|
||||||
httpx
|
httpx
|
||||||
packaging==25.0
|
packaging==25.0
|
||||||
xlsxwriter
|
xlsxwriter
|
||||||
|
django-admin-rangefilter
|
||||||
|
|
@ -181,3 +181,4 @@ zope-interface==8.2
|
||||||
# via gevent
|
# via gevent
|
||||||
xlsxwriter==3.2.3
|
xlsxwriter==3.2.3
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
|
django-admin-rangefilter==0.13.5
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue