Created
September 10, 2024 02:29
-
-
Save douglasmiranda/0a116adb06a2d801623fc22cc44dc4ed to your computer and use it in GitHub Desktop.
Django BaseInlineFormset custom attributes to DELETE button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ScheduleInlineFormSet(BaseInlineFormSet): | |
def add_fields(self, form, index): | |
super().add_fields(form, index) | |
# customizing for bootstrap needs | |
if "DELETE" in form.fields: | |
form.fields["DELETE"] = forms.BooleanField( | |
label="Excluir", | |
widget=forms.CheckboxInput(attrs={"class": "btn-check"}), | |
required=False, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment