Skip to content

Commit

Permalink
fix Card.extra_data
Browse files Browse the repository at this point in the history
  • Loading branch information
simonesestili committed Apr 24, 2024
1 parent b2b5633 commit e6ab91f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions amcards/models.py
@@ -1,3 +1,4 @@
import ast
from enum import Enum
from datetime import datetime
from typing import List, Optional
Expand Down Expand Up @@ -494,7 +495,7 @@ def gifts(self) -> List[Gift]:
@property
def extra_data(self) -> dict:
"""Extra data attached to this card."""
return self._gifts
return self._extra_data

@classmethod
def _from_json(cls, json: dict):
Expand All @@ -519,7 +520,7 @@ def _from_json(cls, json: dict):
base_cost=gift['price'],
shipping_and_handling_cost=gift['shipping_and_handling'],
) for gift in json['gifts']],
extra_data=json.get('extra_data') or {},
extra_data=ast.literal_eval(json.get('extra_data') or '{}'),
)

class MailingStatus(Enum):
Expand Down

0 comments on commit e6ab91f

Please sign in to comment.