Advertisement
horozov86

Widgets with get_form

Feb 23rd, 2024
879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1.     def get_form(self, form_class=None):
  2.         form = super().get_form(form_class)
  3.         form.fields['name'].widget = forms.TextInput(attrs={'placeholder': 'Album Name'})
  4.         form.fields['artist_name'].widget = forms.TextInput(attrs={'placeholder': 'Artist'})
  5.         form.fields['description'].widget = forms.Textarea(attrs={'placeholder': 'Description'})
  6.         form.fields['image_url'].widget = forms.URLInput(attrs={'placeholder': 'Image URL'})
  7.         form.fields['price'].widget = forms.NumberInput(attrs={'placeholder': 'Price'})
  8.         return form
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement