Skip to content

Commit e4ab778

Browse files
committed
perf: optimize submit button check to avoid extra DB query
1 parent 033e5fa commit e4ab778

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

djangocms_form_builder/cms_plugins/ajax_plugins.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ def render(self, context, instance, placeholder):
241241
context.update(self.set_context(context, instance, placeholder))
242242
context["form_counter"] = context.get("form_counter", 0) + 1
243243
has_submit_button = any(
244-
child.plugin_type == "SubmitPlugin" for child in instance.get_children()
244+
child.plugin_type == "SubmitPlugin"
245+
for child in (instance.child_plugin_instances)
245246
)
246247
context.update(
247248
{

0 commit comments

Comments
 (0)