See the Cart.__iter__ method <https://github.com/stephenmcd/cartridge/blob/ffd5aea45febc43b160b4b381fbf5d2cc5a51725/cartridge/shop/models.py#L545> .
On Thu, Jun 9, 2016 at 3:36 PM, Ken Bolton <[email protected]> wrote: > Start with a working installation, then try to understand what it > does. Going the other direction is like learning to read with only an > alphabet and no primer texts. > > -ken > > On Thu, Jun 9, 2016 at 3:19 PM, Ryan Hewitt <[email protected]> > wrote: > > I'm simultaneously learning Django, Mezzanine and Cartridge. For years > I've > > used Python only for small projects and I'm not as familiar with > debugging > > and tooling as I should be. I'm trying to grok the Cartridge codebase as > > fully as possible before using it in my project. > > > > I'm confused about the following block of code in cartridge.models > > > > > > from mezzanine.core.models import SiteRelated > > ... > > class Order(SiteRelated): > > ... > > def setup(self, request): > > ... > > for item in request.cart: > > product_fields = [f.name for f in > SelectedProduct._meta.fields] > > item = dict([(f, getattr(item, f)) for f in product_fields]) > > self.items.create(**item) > > > > > > > > I can't seem to resolve "self.items". I don't see "items" being set > > anywhere in this class or the Mezzanine SiteRelated, or in Django Model, > or > > Django ModelBase. It's not set from > > cartridge.shop.models.Order.session_fields, I don't see this being set by > > cartridge.shop.managers.OrderManager or any of its super classes. It > does > > not seem to inherit from anything resembling dict, nor does dict.items > have > > a create function. Further, I've downloaded PyCharm and set up a > virtualenv > > - the IDE can't seem to resolve it either. > > > > Surely the Order model isn't broken. What am I overlooking? > > > > Link on GitHub: > > > https://github.com/stephenmcd/cartridge/blob/ffd5aea45febc43b160b4b381fbf5d2cc5a51725/cartridge/shop/models.py#L487 > > > > Cartridge==0.11.0 > > > > Django==1.9.5 > > > > Mezzanine==4.1.0 > > > > -- > > 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. > > -- > 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. > -- 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.
