def itemlist(request): item_data = Item.objects.all() itempac = imgselect_pac(item_data) item_list = arr(itempac) context = { 'item':item_list } return render(request, 'gallery/item.html', context)
def itemdetail(request, item_id): try: item_detail = Item.objects.get(pk=item_id) except Item.DoesNotExist: raise Http404("Item does not exist") item_d = imgselect_obj(item_detail) photos = Photo.objects.filter( item__pk = item_id ) photo_pac = imgselect_pac(photos) photo_list = arr(photo_pac) context = {"item":item_d, "photos":photo_list} return render(request, 'gallery/item_detail.html', context)
def index(request): item_data = Item.objects.all()[:3] itempac = imgselect_pac(item_data) context = { 'item':itempac } return render(request, 'gallery/index.html', context)