B
B
bituke2020-10-16 07:40:40
Django
bituke, 2020-10-16 07:40:40

Why doesn't model id change when another model is removed in django?

I will explain more clearly:
5f892362d209b289447437.png
I wrote such a small application, each article is an object from the database. There were others before these articles, but I deleted them.
Question: why, when deleting articles with their own unique identifier, other articles did not order their identifiers, and what could be the consequences of this?
Another question (I just noticed :) ) How to implement a function that, when editing an article, will not change its creation date? For I just edited the last article, and she changed the date of creation, not in order.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kitaev, 2020-10-16
@bituke

There is you with an ID of 100, and there is a person who has collected 10 credits worth 50 million, his ID is 99. The person mysteriously dies, and you "arrange" your ID and become 99. Now you owe the banks 50 million.

S
Sergey Gornostaev, 2020-10-16
@sergey-gornostaev

The whole point of identifiers is that they are immutable. It would be fraught if the articles "ordered their identifiers".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question