Thanks, at the moment I am torn between doing things the way described in the docs, or just directly sub-classing the Product model. I think either way I will have to do a fair bit of work later on to tidy up the admin so the client can use it.
Did you sub-class one of the secondary product models like I'm trying, or Product itself? I think what I found above was a bug, I will post as an issue on BitBucket so the devs can take a look. On Oct 30, 7:00 pm, Trent Jurewicz <[email protected]> wrote: > I've done something similar to what you are attempting using instructions in > this blog > post:http://juanjoalvarez.net/es/detail/2009/jul/27/why-bad-idea-tm-overri.... > We then make our additional data an inline on the Product in the admin. > > ~Trent > > > > On Fri, Oct 30, 2009 at 1:20 PM, anentropic <[email protected]> wrote: > > > has anyone tried sub-classing ConfigurableProduct? > > > it seems like the logical thing to do - I want a product type that has > > the features of a Configurable along with some of my own fields. > > basically all the products in my store would be this type. > > > everything worked fine when it was a non-sub-classed model, but the > > downside is that to create a new product you have to first create a > > Satchmo product, then add a ConfigurableProduct to it, then add my > > custom sub-type as well. I can't imagine asking the client to do all > > that! > > > when I sub-class and go to create/edit a new (satchmo) Product I get: > > > TemplateSyntaxError at /admin/product/product/7/ > > ... > > AttributeError: 'Product' object has no attribute 'ctproduct' > > > The problem seems to be in the 'get_subtypes' method of the Product > > model: > > > try: > > subclass = getattr(self, subtype.lower()) > > gettype = getattr(subclass, '_get_subtype') > > subtype = gettype() > > if not subtype in types: > > types.append(subtype) > > except models.ObjectDoesNotExist: > > pass > > > At first glance it seems to me that the code as-it-is is catching the > > wrong exception (one that would never occur) and my attempt at > > extending a model has tested the code for the first time. But I could > > be completely wrong of course! > > > (I changed it to except AttributeError and the form loads and shows my > > 'add' link in the subtypes... could it be that simple?) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
