Django TypeError missing 1 required positional argument when trying to use form input in another function
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKPz5qhCkKGdpPJ0wkSm5JqlliSJoZg92-H4DuCruovhkVFuXerCphZt9wys_Gr3uwQyXObMHDwattjG5BSeCEl_LdDq1GPLct8qYyRyX4fZ9C93oW-TX7IGZLYDwqRgfFCXA4aUxkBAcS/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6VebLk98DYwS3K2nWZSCatab-q4HrSuRk91M4fQA8SHrKU_-x-lq1n780pSU_bIVLqMRv6pc3dhhh-Y2PUwBS9mM0BxvY1eM6XsM-e7Diu4z-wAoeDG0vB3-2_1U9RE8sO0lg4PHiIXbI/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
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!
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.
can you add your urls.py?
– Jerin Peter George
46 mins ago