pass request to mark_as_refunded()

This commit is contained in:
Thomas Steen Rasmussen 2016-06-19 08:49:30 +02:00
parent 2dca419b81
commit ab180a7c74
2 changed files with 3 additions and 3 deletions

View file

@ -80,6 +80,6 @@ class OrderAdmin(admin.ModelAdmin):
def mark_order_as_refunded(self, request, queryset): def mark_order_as_refunded(self, request, queryset):
for order in queryset.filter(refunded=False): for order in queryset.filter(refunded=False):
order.mark_as_refunded() order.mark_as_refunded(request)
mark_order_as_refunded.description = 'Mark order(s) as refunded' mark_order_as_refunded.description = 'Mark order(s) as refunded'

View file

@ -144,9 +144,9 @@ class Order(CreatedUpdatedModel):
ticket.save() ticket.save()
self.save() self.save()
def mark_as_refunded(self): def mark_as_refunded(self, request):
if not self.paid: if not self.paid:
messages.error(self.request, "Order %s is not paid so cannot mark as refunded!" % self.pk) messages.error(request, "Order %s is not paid, so cannot mark it as refunded!" % self.pk)
else: else:
self.refunded=True self.refunded=True
### delete any tickets related to this order ### delete any tickets related to this order