FEATURE(pg):batch change payments to success/failed
batch change payments to success/failed
This commit is contained in:
parent
4281587396
commit
fe1f535ee6
1 changed files with 10 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ from django.db.models import Sum
|
|||
from django.http import HttpResponse
|
||||
from django.utils import timezone
|
||||
|
||||
from .constans import StateChoices
|
||||
from .models import PaymentRequest, PNA, Fake
|
||||
|
||||
|
||||
|
|
@ -48,14 +49,22 @@ def export_exel(modeladmin, request, queryset):
|
|||
# return the response
|
||||
return response
|
||||
|
||||
@admin.action(description="change to success")
|
||||
def change_to_success(model_admin, request, queryset):
|
||||
for obj in queryset:
|
||||
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.SUCCESS, 'change to success by admin')
|
||||
|
||||
@admin.action(description="change to failed")
|
||||
def change_to_failed(model_admin, request, queryset):
|
||||
for obj in queryset:
|
||||
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.FAILED, 'change to failed by admin')
|
||||
|
||||
|
||||
class PaymentRequestAdmin(admin.ModelAdmin):
|
||||
list_display = ['state', 'uuid', 'splited_amount', 'user_id', 'jajali_datetime', 'created_at', 'application', 'gateway']
|
||||
search_fields = ['application__uuid','application__client_id', 'amount', 'user__uuid']
|
||||
list_filter = ['application', 'state', 'gateway']
|
||||
actions = [export_exel]
|
||||
actions = [export_exel, change_to_success, change_to_failed]
|
||||
|
||||
|
||||
def changelist_view(self, request, extra_context=None):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue