Slow admin site with large product inventory

Issue #631 resolved
Former user created an issue

The satchmo admin site is very slow (hour long page loads) with the current field types. Any admin page with a field which is a ForeignKey or ManyToManyField pointing to the "Product" class exhibits this behaviour.

I believe I have located every instance of this in 3 different admin.py files

discount/admin.py: add - raw_id_fields = ('validProducts',) to - class DiscountOptions

product/admin.py: add - raw_id_fields = ('related_items', 'also_purchased',) to - class ProductOptions

add - raw_id_fields = ('product',) to - class CustomProductOptions

add - raw_id_fields = ('product',) to - class SubscriptionProductOptions

add - raw_id_fields = ('product','parent',) to - class ProductVariationOptions

add - classes DownloadableProductOptions and ConfigurableProductOptions to - product/admin.py

add - raw_id_fields = ('product',) to - classes DownloadableProductOptions and ConfigurableProductOptions

change - admin.site.register(ConfigurableProduct) to - admin.site.register(ConfigurableProduct, ConfigurableProductOptions)

change - admin.site.register(DownloadableProduct) to - admin.site.register(DownloadableProduct, DownloadableProductOptions)

shop/admin.py add - raw_id_fields = ('product',) to - classes CartItem_Inline, CartItemOptions, OrderItem_Inline, OrderItemOptions

Reported by stevebee

Comments (6)

  1. Anonymous

    This patch works, but it is not complete. I believe also the ModelAdmin and InlineModelAdmin objects should have the old options removed for the fields to which this patch adds new options.

  2. Log in to comment