I have to create a simple CRUD panel for an active MySQL database. When I try to migrate my application I receive the following error:
AssertionError: A model can't have more than one Autofield
I've read the following in The Django Book, Chapter 18:
Each generated model has an attribute for every field, including id primary key fields. However, recall that Django automatically adds an id primary key field if a model doesn’t have a primary key. Thus, you’ll want to remove any lines that look like this:
id = models.IntegerField(primary_key=True)
Not only are these lines redundant, but also they can cause problems if your application will be adding new records to these tables.
I have the same scenario with this field:
id_call = models.BigIntegerField(primary_key=True)
However, if I follow the above suggestion and remove this line, the original application (not the django application) using this table may not work properly because it could be calling data from this table using this id_call
field.
How can I resolve this situation?