Kenneth, This is good advice generally. Still, I like to approach projects this way because I believe it forces me to flex all sorts of mental developer muscles that would otherwise atrophy. I don't want to lose the ability to construct and explore a data model in my head and I find it educational to work bottom-to-top. Perhaps I'm just a masochist?
Also: I come from an enterprise, IDE-heavy Java background and from there moved into full stack JavaScript. In both of these languages I have experience with fantastic step-through debuggers and inspectors. In Python I've so far been constrained to logging, the REPL, and to pdb.set_trace(). I only just found that I can use pdb interactively when Django is in Debug mode. Can you recommend a better, more feature-rich way to step through my Python programs? On Thursday, June 9, 2016 at 12:36:31 PM UTC-7, Kenneth Bolton 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] > <javascript:>> 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] <javascript:>. > > 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.
