I have a model called Question and this model allow users to create new questions. A user creates 10 question . How can I populate 10 forms with the question inside? Because I know I can populate a form with single object but when I try to populate 10 objects . The reason I want to populate 10 objects is to allow the user to edit his question
How could this be done?
thank you ,
I receive this error
'QuerySet' object has no attribute '_meta'
models.py
class Question(models.Model):
question= models.CharField(max_length=500)
user = models.ForeignKey(User)
forms
class QuestionForm(forms.ModelForm):
class Meta:
model = Question
fields = ('question',)
views
def DisplayAll(request):
q = Question.objects.filter(user=request.user)
form = QuestionForm(instance=q)
return render(request,'question.html',{'form':form })
forms.py
{% for f in form %}
{{form}}
{% endfor %}