Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.shortcuts import render
- from .models import Pizza,Topping
- def home(request):
- return render(request,'pizzas/home.html')
- def shops(request):
- shops = Pizza.objects.order_by('date_added')
- context = {'shops':shops}
- return render(request,'pizzas/shops.html',context)
- def pizza(request,pizza_id):
- pizza = Pizza.objects.get(id=pizza_id)
- describe = pizza.topping_set.order_by('-date_added')
- context = {'pizza':pizza,'describe':describe}
- return render(request,'pizzas/pizza.html',context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement