Hi there, Subclassing the product model was previously not a supported feature - I imagine you had to do some extensive hacking to get that working in the actual site.
It now is a supported feature however, much like the Page model in Mezzanine can be subclasses to create custom page types, custom products now work the same in the development version of Cartridge. The good news is that what you've done should mostly work now - it's just that your existing products are missing a value that identifies them as your BaseProduct custom product type - if you inspect the DB somehow, you'll see the table for the Product model has a "content_type" field (if I recall correctly), and it stores a string name for the type of product it's related to, in your case I think the value would be "baseproduct", but the best way to know for sure would be to add a new product of "BaseProduct" type, and see what value gets stored for that. BTW the redirection is occurring because with this new version, *all* product subclasses in the admin will redirect to one listing page where they all get managed. You'll see an "Add product" dropdown list (presumably with only one item in it in your case, namely BaseProduct), which is how you choose which type of product you're adding. You'll need to use that to perform the check I just mentioned. Given the way the admin works now, you'll also be able to remove BaseProduct from the ADMIN_MENU_ORDER setting you have, since that's redundant. On Thu, Jan 26, 2017 at 1:22 AM, Pete Dermott <[email protected]> wrote: > Apologies if this this an existing issue or I'm missing something but I am > having a little trouble with my cartridge installation and my custom > product types, I am running on the current versions of Mezzanine and > Cartridge from the GitHub repos. > > Previously I have declared my custom product type in the settings.py file > as follows: > > ADMIN_MENU_ORDER = ( > ... > ("My Shop", ( > "my_shop.BaseProduct", > )), > > ... > > > .. in my models as: > > from cartridge.shop.models import Product, Category, ProductVariation, > ProductImage > > > ... > > > class BaseProduct(Product): > cadfile = fields.FileField(upload_to="product/cadfile", > extensions=(".dwg",), blank=True, null=True, help_text="Format: Files should > be named in all lower case with leading zeros and ONLY product codes e.g > rg09.dwg") > pdffile = fields.FileField(upload_to="product/pdffile", blank=True, > null=True, help_text="Format: Files should be named in all lower case with > leading zeros and ONLY product codes e.g pm01.pdf") > product_code = models.CharField(max_length=8, help_text="Format: All > caps, no spaces, include leading zero's, e.g DC01B") > > ... > > > > ... and in the admin as: > > from cartridge.shop.admin import CategoryAdmin, ProductAdmin, > ProductVariation, ProductOption, Order > > > ... > > > class BaseProductAdmin(ProductAdmin): > fieldsets = product_fieldsets > > additional_fieldsets = ("product_height", "product_width", > "product_projection", "product_diameter", "product_length", > "cornice_picture", "cornice_profile_picture", > "cornice_wall_height", "cornice_ceiling_projection", > "cornice_pattern_repeat", "internal_height", > "internal_width", "priority",) > > fieldsets.append( > (_("Additional"), { > "fields": tuple(additional_fieldsets), > })) > > list_display = product_list_display > list_filter = ("status", "available", "categories", "product_type", > "updated") > > def has_module_permission(self, request): > for (name, items) in settings.ADMIN_MENU_ORDER: > if "stevensons_shop.BaseProduct" in items: > return True > return False > > > admin.site.register(BaseProduct, BaseProductAdmin) > > > > This used to work fine in previous versions of the system (those installed > directly from pip), however I wanted to take advantage of some of the fixes > in newer versions. > > However this has had the adverse affect of breaking my admin area. Whereas > before I could simply click on the "Base product" sidebar link and get > taken to my admin view I now am immediately redirected to the generic > /admin/shop/product view that only contains the basic information for my > product and none of my extended fields, I'm aware that there have been some > pretty major changes that happened in commit #8d3ac6b > <https://github.com/stephenmcd/cartridge/commit/8d3ac6bef9ca4f557edcd4d714a02f69644570dc#diff-79b579f857f436c0b1f13b7397ed6c00> > however > I am currently at a loss trying to figure out what I need to do to get this > working again. > > Any suggestions are greatly appreciated. > > -- > 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. > -- Stephen McDonald http://jupo.org -- 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.
