Skip to content
Advertisement

How to add Two auto-generated field in one model in Django

I am in need to create two auto-generated fields: 1st field is ID and I am taking the position that is equivalent to id or we can say it is also an auto-generated field in the model.

here is the code which I am integrating:

JavaScript

please help me to solve this.

Advertisement

Answer

You can override the save method to set the initial value of position:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement