view.py
from .models import Banana, Mango
list = request.GET['fruit[]']
for x in list:
conn = x.objects.all()
print(conn.name)
in html file: I use checkbox to choose "Mango" and "Banana", and view.py get the value of checkbox. Then I want to select the model of user choices.
when I run this code, it is appear AttributeError at /search 'str' object has no attribute 'objects'.
In that's code, I want to return name value of objects model in my models.py
How I can replace string in List to call object models in django?