Skip to content

Commit 630cc19

Browse files
committed
Revert "add search_field to paymentRequest"
This reverts commit 98ee0ce.
1 parent 98ee0ce commit 630cc19

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

Diff for: backend/payment/admin.py

+6-19
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
from payment.models import PaymentDiscount, PaymentRequest
1111
from core.models import Event
1212

13-
1413
# Register your models here.
1514

1615
class CsvImportForm(forms.Form):
1716
csv_file = forms.FileField()
1817

19-
2018
class PaymentDiscountAdmin(admin.ModelAdmin, ExportCSVMixin):
2119
search_fields = ('code',)
2220
list_display = ('code', 'percentage', 'amount', 'count')
@@ -51,33 +49,23 @@ def get_urls(self):
5149
]
5250
return my_urls + urls
5351

54-
5552
admin.site.register(PaymentDiscount, PaymentDiscountAdmin)
5653

57-
5854
class DiscountCodesImportForm(forms.Form):
5955
file = forms.FileField()
6056

61-
6257
class PaymentRequestAdmin(admin.ModelAdmin, ExportCSVMixin):
63-
list_display = ('participant', 'timestamp', 'paid', 'discount__code', 'order_id', 'base_price', 'paid_price')
58+
list_display = ('participant', 'timestamp', 'paid', 'discount_code', 'order_id', 'base_price', 'paid_price')
6459
list_filter = ('paid', 'discount__code')
6560
actions = ["export_as_csv", "calculate_discount_usage"]
6661
change_list_template = "payment_request_changelist.html"
67-
search_fields = (
68-
'participant__user__email',
69-
'participant__info__first_name',
70-
'participant__info__last_name',
71-
'order_id',
72-
'discount__code',
73-
)
7462

7563
def base_price(self, obj):
7664
return obj.get_price()[0]
77-
65+
7866
def paid_price(self, obj):
7967
return obj.get_price()[1]
80-
68+
8169
def discount_code(self, obj):
8270
return obj.discount.code if obj.discount is not None else None
8371

@@ -100,7 +88,7 @@ def calculate_discount_usage(self, request, queryset):
10088

10189
for discount in discount_codes:
10290
total_usage = queryset.filter(discount=discount).count()
103-
91+
10492
successful_payments = queryset.filter(
10593
discount=discount,
10694
paid=True
@@ -123,7 +111,7 @@ def import_discount_codes(self, request):
123111
file = request.FILES["file"]
124112
content = file.read().decode('utf-8')
125113
discount_codes = [code.strip() for code in content.split('\n') if code.strip()]
126-
114+
127115
response = HttpResponse(content_type='text/csv')
128116
response['Content-Disposition'] = 'attachment; filename=discount_usage_report.csv'
129117
writer = csv.writer(response)
@@ -171,5 +159,4 @@ def get_urls(self):
171159
]
172160
return my_urls + urls
173161

174-
175-
admin.site.register(PaymentRequest, PaymentRequestAdmin)
162+
admin.site.register(PaymentRequest, PaymentRequestAdmin)

0 commit comments

Comments
 (0)