Python3/Django - Search Bar Query - Filter through Multiple Models(3) - Chain Results - Only displays results from one model.
Beginner Coder here: Trying to practice building a search bar that will take the user's input and query the input through filters on multiple Models (3 of them). Results should chain together in a list and then return those results in a search page using a for in loop.
Results of searching for data found in 1st Model: Works perfectly - all rows requested are returned.
Results of searching for data found in 2nd Model: , , (literally commas)
Results of searching for data found in 3rd Model: key returned followed by commas.
Any help would be most appreciated.
form on home page with search bar:
urls.py (works fine, but including anyway)
Info re: 3 Models used - too big to display so just pasting Class with attributes for each model instance:
name = models.CharField(max_length=30)
grade = models.IntegerField()
gender = models.CharField(max_length=15)
name = models.CharField(max_length=10)
record = models.CharField(max_length=10)
points = models.IntegerField()
first_name = models.CharField(max_length=20)
number = models.IntegerField()
position = models.CharField(max_length=2)
Hope this is enough information to explain what I am not doing correctly.
avan last edited by
You are probably way past this but I would recommend printing out the whole object list before you print out team, player and stats. That way you can see if everything looks correct before printing formatted info. If the info is not correct go back and try to determine where it failed to load the data correctly. I would use print statements again for that.