Tuesday, June 20, 2017

Re: import different entries using filter

On Monday 19 June 2017 21:11:23 jon stan wrote:

 

> im trying to display the products and service type based on the name

> but i cant figure out how todo that. here's what i have:

>

> views.py

> name =

> food.objects.get(restaurant-name__icontains='burger-place') prod =

> food.objects.filter(restaurant-name__icontains='burger-place').filter(

> products__icontains='burgers') service =

> food.objects.filter(restaurant-name__icontains='burger-place').filter(

> service__icontains='fast food')

>

> but i cant get it to work correctly. i get 'burger-place' for the

> name, prod, and service variables for some reason.

 

You are confusing attributes and models ("fields vs tables"). Please revisit the Django tutorial.

 

--

Melvyn Sopacua

No comments:

Post a Comment