Skip to content

Commit

Permalink
Merge pull request #2136 from RomainFayolle/feature-filter_admin_orde…
Browse files Browse the repository at this point in the history
…rline

format transaction_date in orderline export
  • Loading branch information
RomainFayolle authored Nov 3, 2023
2 parents 15fc2a1 + 602c30a commit c79c650
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions store/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ class OrderLineResource(resources.ModelResource):
attribute='content_type__model',
)

transaction_date = fields.Field(
column_name='transaction_date',
attribute='order__transaction_date',
)
transaction_date = fields.Field()

item_name = fields.Field()

Expand All @@ -115,6 +112,10 @@ def dehydrate_item_id(self, orderline):
model = get_model_from_name(orderline.content_type.model)
return model.objects.get(id=orderline.object_id).id

def dehydrate_transaction_date(self, orderline):
date = orderline.order.transaction_date
return date.strftime('%Y-%m-%d %H:%M:%S')

class Meta:
model = OrderLine
fields = (
Expand Down

0 comments on commit c79c650

Please sign in to comment.