1👍
✅
You’ve redefined the signature of your form so that the first argument is hero
, but then you instantiate it with just request.POST
.
Instead of doing that, get hero
from the kwargs, and always make sure you accept both args and kwargs.
def __init__(self, *args, **kwargs):
hero = kwargs.pop('hero', None)
super(DeckForm, self).__init__(*args, **kwargs)
if hero:
...
Remember to pass the hero argument in by keyword:
return render(request, 'hsguides/guide_create.html', {
'DeckForm': DeckForm(hero=hero),
'GuideForm': GuideForm,
})
Source:stackexchange.com