Check if child plugin instances exist before looping over them
This commit is contained in:
parent
3fca9dbb0d
commit
d15a4da840
1 changed files with 8 additions and 7 deletions
|
@ -92,13 +92,14 @@ class DCLCalculatorPlugin(CMSPluginBase):
|
||||||
context['children_to_side'] = []
|
context['children_to_side'] = []
|
||||||
context['children_to_content'] = []
|
context['children_to_content'] = []
|
||||||
pricing_plugin_model = None
|
pricing_plugin_model = None
|
||||||
for child in instance.child_plugin_instances:
|
if instance.child_plugin_instances:
|
||||||
if child.__class__.__name__ == 'DCLCustomPricingModel':
|
for child in instance.child_plugin_instances:
|
||||||
# The second clause is just to make sure we pick up the most
|
if child.__class__.__name__ == 'DCLCustomPricingModel':
|
||||||
# recent CustomPricing, if more than one is present
|
# The second clause is just to make sure we pick up the
|
||||||
if (pricing_plugin_model is None or child.pricing_id >
|
# most recent CustomPricing, if more than one is present
|
||||||
pricing_plugin_model.model.pricing_id):
|
if (pricing_plugin_model is None or child.pricing_id >
|
||||||
pricing_plugin_model = child
|
pricing_plugin_model.model.pricing_id):
|
||||||
|
pricing_plugin_model = child
|
||||||
|
|
||||||
if pricing_plugin_model:
|
if pricing_plugin_model:
|
||||||
context['vm_pricing'] = VMPricing.get_vm_pricing_by_name(
|
context['vm_pricing'] = VMPricing.get_vm_pricing_by_name(
|
||||||
|
|
Loading…
Reference in a new issue