FEATURE(pg):adding is registered field to payment request and batch mark as registered
adding is registered field to payment request and batch mark as registered
This commit is contained in:
parent
fe1f535ee6
commit
8ceb818edc
3 changed files with 28 additions and 2 deletions
|
|
@ -59,12 +59,18 @@ def change_to_failed(model_admin, request, queryset):
|
||||||
for obj in queryset:
|
for obj in queryset:
|
||||||
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.FAILED, 'change to failed by admin')
|
obj.change_state(StateChoices.WALLET_SUBMIT_SUCCESS, StateChoices.FAILED, 'change to failed by admin')
|
||||||
|
|
||||||
|
@admin.action(description="mark as registered")
|
||||||
|
def mark_as_registered(model_admin, request, queryset):
|
||||||
|
for obj in queryset:
|
||||||
|
obj.is_registered = True
|
||||||
|
obj.save(update_fields=['is_registered'])
|
||||||
|
|
||||||
|
|
||||||
class PaymentRequestAdmin(admin.ModelAdmin):
|
class PaymentRequestAdmin(admin.ModelAdmin):
|
||||||
list_display = ['state', 'uuid', 'splited_amount', 'user_id', 'jajali_datetime', 'created_at', 'application', 'gateway']
|
list_display = ['state', 'uuid', 'splited_amount', 'user_id', 'jajali_datetime', 'is_registered', 'created_at', 'application', 'gateway']
|
||||||
search_fields = ['application__uuid','application__client_id', 'amount', 'user__uuid']
|
search_fields = ['application__uuid','application__client_id', 'amount', 'user__uuid']
|
||||||
list_filter = ['application', 'state', 'gateway']
|
list_filter = ['application', 'state', 'gateway']
|
||||||
actions = [export_exel, change_to_success, change_to_failed]
|
actions = [export_exel, change_to_success, change_to_failed, mark_as_registered]
|
||||||
|
|
||||||
|
|
||||||
def changelist_view(self, request, extra_context=None):
|
def changelist_view(self, request, extra_context=None):
|
||||||
|
|
|
||||||
18
apps/pg/migrations/0006_paymentrequest_is_registered.py
Normal file
18
apps/pg/migrations/0006_paymentrequest_is_registered.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.1.4 on 2025-10-14 11:09
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pg', '0005_fake'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='paymentrequest',
|
||||||
|
name='is_registered',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -41,6 +41,8 @@ class PaymentRequest(models.Model):
|
||||||
phone_number = models.CharField(max_length=255, null=True, blank=True)
|
phone_number = models.CharField(max_length=255, null=True, blank=True)
|
||||||
callback_url = models.CharField(max_length=255, null=True, blank=True)
|
callback_url = models.CharField(max_length=255, null=True, blank=True)
|
||||||
|
|
||||||
|
is_registered = models.BooleanField(default=False)
|
||||||
|
|
||||||
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
|
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True, db_index=True)
|
updated_at = models.DateTimeField(auto_now=True, db_index=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue