y = (Product.objects.all()).count()
x = random.randint(3,y)
prouct1 = Product.objects.get(id = x+1)
prouct2 = Product.objects.get(id = x-1)
prouct3 = Product.objects.get(id = x-2)
I want to obtain 3 random products everytime i run a function initially i use the above method But the problem with this is If i delete a object Then i get the error i dont want that thing to happen obviously i can run more checks but i feel there is some simple way to do that The objective is to Get the random object from the database every time the page is renderd