I'm trying do this:
class NoClearableFileInput(ClearableFileInput): initial_text = '' input_text = '' class ImageUploadForm(forms.ModelForm): title = forms.CharField(label="TITLE", required=False,widget=forms.TextInput(attrs={'placeholder': 'name'}), label_suffix="") image = forms.ImageField(label='NEW FILE',widget=NoClearableFileInput, label_suffix="") class Meta: model = Image fields = ('title','image')
There in class NoClearableFileInput cleaned value initial_text. In fields 'title' and 'image' use label_suffix, but from initial_text symbol ":" remained.
result
How get rid of the colons?
This just worked for me with Django 2.2:
class ImageUploadForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.label_suffix = "" # Removes : as label suffix
# ...the rest of the form code...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With