matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
197 stars 63 forks source link

How to extend the OrderItem with own attributes? #49

Closed BuddhaOhneHals closed 7 years ago

BuddhaOhneHals commented 11 years ago

Hi,

first of all: thanks for the shop! It's fun to work with it.

At the moment, I'm stuck. I cannot find any solution for my current problem: How can I extend the OrderItem with more model fields?

The problem seems to be the Relation between the OrderItem and the Order. The Order creates OrderItems which are defined by the related_name "items". So an own class "MyOrderItem" won't work here.

Do you have any hints for me?

Thanks a lot, Timo

matthiask commented 11 years ago

Timo,

Both Order and OrderItem come with a data JSON field which can be used for storing additional attributes. If that's not enough you could create your own model with a OneToOneField to OrderItem, and save your additional attributes there.

Modifying or extending the order item model itself probably will cause some pain down the road.

Does that help?

BuddhaOhneHals commented 11 years ago

Hi,

sorry for the late reply and thank you for your response. We used the data field for the additional information.