Hi all,
I am learning Mezzanine+Cartridge as I am trying to make a shop site for
men custom suits. I've been looking into Cartridge shop source code and
trying to figure out how to allow customers to add their sizes/dimensions
related to their items(suits) in the order. I created a new app called
"customDimensions"
class CustomDimension(models.Model):
order = models.ForeignKey(Order, null=True, blank=True)
selected = Order.items
# user = models.OneToOneField(settings.AUTH_USER_MODEL)
neck = models.DecimalField(max_digits=4, decimal_places=2, blank=True,
null=True)
full_chest = models.DecimalField(max_digits=4,decimal_places=2, blank=
True, null=True)
full_shoulder_width = models.DecimalField(max_digits=4, decimal_places=2
, blank=True, null=True)
right_sleeve = models.DecimalField(max_digits=4, decimal_places=2, blank
=True, null=True)
left_sleeve = models.DecimalField(max_digits=4, decimal_places=2, blank=
True, null=True)
then put it as extra field (ForeignKey) to OrderItem like this
EXTRA_MODEL_FIELDS = (
(
'cartridge.shop.models.OrderItem.custom_dimension',
'ForeignKey',
('customDimensions.CustomDimension',),
{'blank': True, 'null':True},
),
)
After playing with the admin.py in the customDimensions app, I was able to
add the custom dimension field to the Order admin page
(admin.StackedInline) like in this picture
<https://lh3.googleusercontent.com/-elef6Wv9iXY/V1y2oRvl3dI/AAAAAAAALbs/ojic-HGYGgssARfNTk9N2qxmtn-LTL8FACLcB/s1600/customDim.JPG>
My goal is to add a form in the shop templates (either "Your Cart" page or
"Product.html) so customers can put their custom sizes to their
selected items. However, I don't know how to "link" the selected
product and the custom dimensions. Right now, it seems both are still
separated. As you can see in the picture, the items box has the "Custom
dimension" field and also underneath, I put the StackedInline for "custom
dimensions" as well. But the dimensions in these two panels are not related
at all.
If you have some suggestions how I can approach this better, please let me
know! Thank you
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.