Avoid "auto disable" button logic for new message form
This commit is contained in:
parent
22236e2909
commit
5b4718fac4
|
@ -323,6 +323,7 @@ class Form(object):
|
|||
save_label = "Save"
|
||||
update_label = "Save"
|
||||
show_cancel = True
|
||||
auto_disable = True
|
||||
|
||||
def __init__(self, fields=None, schema=None, request=None, readonly=False, readonly_fields=[],
|
||||
model_instance=None, model_class=None, nodes={}, enums={}, labels={}, renderers=None,
|
||||
|
@ -685,6 +686,9 @@ class Form(object):
|
|||
context = kwargs
|
||||
context['form'] = self
|
||||
context['dform'] = dform
|
||||
context['form_kwargs'] = {}
|
||||
if self.auto_disable:
|
||||
context['form_kwargs']['class_'] = 'autodisable'
|
||||
context['request'] = self.request
|
||||
context['readonly_fields'] = self.readonly_fields
|
||||
context['render_field_readonly'] = self.render_field_readonly
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
% if not readonly:
|
||||
<% _focus_rendered = False %>
|
||||
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', class_='autodisable')}
|
||||
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', **form_kwargs)}
|
||||
${h.csrf_token(request)}
|
||||
% endif
|
||||
|
||||
|
|
|
@ -182,6 +182,9 @@ class MessagesView(MasterView):
|
|||
def configure_form(self, f):
|
||||
super(MessagesView, self).configure_form(f)
|
||||
|
||||
# we have custom logic to disable submit button
|
||||
f.auto_disable = False
|
||||
|
||||
# TODO: A fair amount of this still seems hacky...
|
||||
|
||||
f.set_renderer('sender', self.render_sender)
|
||||
|
|
Loading…
Reference in a new issue