Answer the question
In order to leave comments, you need to log in
How to switch id on offsets in output list in Django?
Hello everyone
We have a student model. There are 100 students in total. Output to the page is carried out by ID (1, 2, 3, and so on). We need to move a few posts up. Those. actually change their ID and the entire list below.
Logic suggests that you need to:
1) Take the entry itself to increase its ID
2) Take the break point and loop +1 for the ID for the remaining entries.
But, in Django ID is a unique field and you cannot set it to another number if it already exists.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question