I work with models in jango, it took a cycle
forwarder = Forwarder.objects.all() sum_forwarders = forwarder.count() for i in range(sum_forwarders): current_forwarder = Forwarder.objects.get(id=i).proj.all() But I get an error
bot.models.DoesNotExist: Forwarder matching query does not exist. The bottom line is that I created an element, django assigned id=1
After removing the element id=1 , None is formed in its place.
And when creating a new one, it will already be under id=2 , and id=1 will remain with the value None
Can you please tell me in which way I can update this, or in what way can I go through a cycle starting with values that have the correct id?
And anyway, why does everything happen in exactly this way? Why doesn't django delete an item along with its id?
for forwarder in Forwarder.objects.all()? - Sergey Gornostaev