Django TypeError missing 1 required positional argument when trying to use form input in another function

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP

Django TypeError missing 1 required positional argument when trying to use form input in another function



I'm really a noob.



What I'am trying to do is to use an input (a category to display) from a ModelForm and pass it to another function, which would render a table accordingly on the next page.



Here is the first function from my views.py
def index(request):
form1 = PrimarySearchForm(request.POST)


if form1.is_valid():
return results(request, form1.cleaned_data['actor'])
template = 'main/index.html'
context = 'form1': form1
return render(request, template, context)



Here is the second function from views.py


def results(request, actor):
table = FactTable(Sawn_Areas_Fact.objects.get(actors=actor))
RequestConfig(request).configure(table)
return render(request, 'main/results.html', 'table': table)



Here is the form
class PrimarySearchForm(forms.ModelForm):


class Meta:
model = Actors_Dim
fields = ('actor',)



So, when I run the server, select an entry and click submit I get the following error message:


TypeError: results() missing 1 required positional argument: 'actor'
[29/Jul/2018 17:10:04] "POST /results/ HTTP/1.1" 500 59914



Thanks in advance for any help!





can you add your urls.py?
– Jerin Peter George
46 mins ago





What is FactTable. Show code.
– VolArt
45 mins ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

Executable numpy error

PySpark count values by condition

Mass disable jenkins jobs