1👍
✅
0👍
According to your expected out, I think you have to add widgets to your form.
try this:
class new_album_form(forms.ModelForm):
class Meta:
model = album
fields = ['album_name', 'album_artist', 'released_at', 'price', 'is_approved']
widgets = {
'album_name': forms.TextInput(attrs={'class':'form-
control'}),
'album_artist': forms.TextInput(attrs={'class':'form-
control'}),
'release_at': forms.DateTimeInput(attrs={'class':'form-
control', 'data-target': '#datetimepicker1'}),
#Add your remaining widgets here
}
And in templates:
<input type="date" data-target="#datetimepicker1" class="form-control" value="{{form.release_at}}" /> #form is a context name from views.py file
- [Answered ]-Post push notification to C2DM (android) using Django
- [Answered ]-Try to Return dataset as a table with request of postman
- [Answered ]-Can I extend a function based view?
- [Answered ]-Hidden form field using none model forms
Source:stackexchange.com