Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Using FormSet to editing a array of same form in django

$
0
0

My requirement here is to enable user to add description and remark against multiple files uploaded earlier.I am using formset to display a set of partial field data of a model 'medical_doc'. I am new to django and am not able to implement it properly.

form.pyclass Files_uploadedForm(forms.Form)    doc_name=forms.CharField(max_length=100)    doc_type=forms.CharField(max_length=5)    description=forms.CharField(max_length=100)    remarks=forms.CharField(max_length=100)Files_uploadedFormSet=formset_factory(Files_uploadedForm)view.pyif request.method='POST'    med_qrset=medical_doc.objects.values('doc_name','doc_type','description','remarks') .filter(doc_id=doc_id)    formset=Files_uploadedFormSet(queryset=med_qrset)context = {'formset'=formset}return render(request,"upload_doc.html")upload_doc.html...{% for form in formset %}form.as_p{% endfor %}

Please excuse the syntax errors. My issue here is to know if this method of initialising formset is correct. Because I get a error saying that BaseFormSet.init() got an unexpected keyword argument 'queryset'. Please help.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>