This is the what-I-want ( warning: Python noob here, this might be an incorrect way of representing, but I hope you get what I want )
forms = {
{ 'id' : '1',
'form' : form_something,
},
{ 'id' : '4',
'form' : form_something2,
}
}
Now my question is how do I create this dictionary in my django view which goes like this, so far->
links = Links.objects.all()
forms = {}
for link in links:
form = LinkForm(instance = link )
forms.update({ 'id' : link.id, 'form' : form})
# which is obviously the wrong way to do it
formsis not a valid python dictionary. It is a set of two dictionaries, and you can't do it, because dictionaries are not hashable.