Skip to content

Commit

Permalink
transaction_date in orderline export
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainFayolle committed Nov 3, 2023
1 parent 24f5c1d commit 602c30a
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 602c30a

Please sign in to comment.