Deleting pk in django model

I have models Recipe and StepToRecipe which have fields:
recipe = models.ForeignKey(Recipe)
num = models.IntegerField()
text = models.TextField()
So i didn’t need autoincrement field How I can make django model not to set up it?

Yes you do. Or, more specifically, Django does.

Django requires a single-column primary key.

It’s how the ORM uniquely identifies a row.

If you don’t need to reference it directly, that’s fine. But Django needs it to manage the associations it creates between database rows and the Python objects managed by the ORM.

1 Like

Oh, thank you. I also came to this conclusion but I wasn’t sure. But how can I protect auto incremented integer fields from overloading? In my program’s logic it’s better to delete and create steptorecipe fields rather than update them. But if my system gets bigger, auto incremented fields will face an integer overload

Uh, the standard integer field for the primary key is a 64-bit integer.

No, it’s never going to overflow.

1 Like

Okay, thank you very much!