mirror of
https://github.com/Crocmagnon/checkout.git
synced 2024-11-23 08:38:02 +01:00
15 lines
493 B
Python
15 lines
493 B
Python
from crispy_forms.layout import Field
|
|
|
|
|
|
class BasketItemField(Field):
|
|
template = "purchase/snippets/basket_item.html"
|
|
|
|
def __init__(self, *args, product, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.product = product
|
|
|
|
def render(self, *args, **kwargs):
|
|
extra_context = kwargs.get("extra_context", {})
|
|
extra_context.update({"product": self.product})
|
|
kwargs["extra_context"] = extra_context
|
|
return super().render(*args, **kwargs)
|