Monday, 22 October 2018

How to change Submit button text from a view in crispy-forms?

In my forms.py I have the following:

self.helper.layout = Layout(
    Fieldset(
        None,
        'name'
    ),
    FormActions(
        Submit('submit', 'Add Thing', css_class='btn-primary')
    )
)

But I am using the same view to add and edit the item. So I want to change the button text (Add Thing above) based on some condition in my views.py. How can I do that?



from How to change Submit button text from a view in crispy-forms?

No comments:

Post a Comment