def product_inline(request, product, template_name="lfs/catalog/products/product_inline.html"):
    pid = product.get_parent().pk
    properties_version = get_cache_group_id('global-properties-version')
    group_id = '%s-%s' % (properties_version, get_cache_group_id('properties-%s' % pid))
    cache_key = "%s-%s-product-inline-%s-%s" % (settings.CACHE_MIDDLEWARE_KEY_PREFIX, group_id,
                                                request.user.is_superuser, product.id)
    result = cache.get(cache_key)
    if result is not None:
        return result

    # Switching to default variant
    if product.is_product_with_variants():
        temp = product.get_default_variant()
        product = temp if temp else product

    properties = []
    variants = []

    display_variants_list = True
    if product.is_variant():
        parent = product.parent
        properties = parent.get_all_properties(variant=product)

        if parent.variants_display_type != SELECT:
            variants = parent.get_variants()
        else:
            display_variants_list = False

    elif product.is_configurable_product():
        for property_dict in product.get_configurable_properties():
            property_group = property_dict['property_group']
            prop = property_dict['property']
            options = []
            try:
                ppv = ProductPropertyValue.objects.get(product=product, property_group=property_group,
                                                       property=prop, type=PROPERTY_VALUE_TYPE_DEFAULT)
                ppv_value = ppv.value
            except ProductPropertyValue.DoesNotExist:
                ppv = None
                ppv_value = ""

            for property_option in prop.options.all():
                if ppv_value == str(property_option.id):
                    selected = True
                else:
                    selected = False

                options.append({
                    "id": property_option.id,
                    "name": property_option.name,
                    "price": property_option.price,
                    "selected": selected,
                })
            properties.append({
                "obj": prop,
                "id": prop.id,
                "name": prop.name,
                "title": prop.title,
                "unit": prop.unit,
                "display_price": prop.display_price,
                "options": options,
                "value": ppv_value,
                "property_group": property_group,
                "property_group_id": property_group.id if property_group else 0
            })

    if product.get_template_name() is not None:
        template_name = product.get_template_name()

    if product.get_active_packing_unit():
        packing_result = calculate_packing(request, product.id, 1, True, True)
    else:
        packing_result = ""

    # attachments
    attachments = product.get_attachments()

    result = render_to_string(template_name, RequestContext(request, {
        "product": product,
        "variants": variants,
        "product_accessories": product.get_accessories(),
        "properties": properties,
        "packing_result": packing_result,
        "attachments": attachments,
        "quantity": product.get_clean_quantity(1),
        "price_includes_tax": product.price_includes_tax(request),
        "price_unit": product.get_price_unit(),
        "unit": product.get_unit(),
        "display_variants_list": display_variants_list,
        "for_sale": product.get_for_sale(),
    }))

    cache.set(cache_key, result)
    return result
Axis with custom colors
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/views.py/product_inline--crossover with--dataset/ETHPy150Open tkrajina/cartesius/create_images_and_readme.py/test_axis_custom_colors