'how to pass file from local storage to html
so i want get my file from local storage to show in html using django. but i don't know how to get it. the file is audio mp3. i was using form NOT MODALS. i need reference of example code. if you need my code form.py here's :
from django import forms
class Audio_store(forms.Form):
password=forms.FileField(widget=forms.FileInput(attrs={'style': 'width: 300px;', 'class': 'form-control',
'text-align' : 'center;'}))
audio=forms.FileField(widget=forms.FileInput(attrs={'style': 'width: 300px;', 'class': 'form-control',
'text-align' : 'center;'}))
i was try using formset, but i don't know how to use it. here's my views.py code :
def song(request):
songmp3 = formset_factory(Audio_store)
if request.method == 'POST':
formset = songmp3(request.POST, request.FILES)
if formset.is_valid():
# do something with the formset.cleaned_data
pass
else:
formset = songmp3()
return render(request, 'homepage.html', {'formset': formset})
Solution 1:[1]
To get the selected option (both index and text), use the DropDown.GetCurrentOption() method:
i, s := form.GetFormItem(0).(*tview.DropDown).GetCurrentOption()
fmt.Printf("%d %s\n", i, s)
Example output:
2 Mrs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | icza |
