0
Due to an old need of a project, the developer of the time created a field in the table that is not a primary key but is auto incrementable, however, Django returns an error for not being able to update this field. Django’s Autofield type is intended for primary key, the same cannot be used in this case, but I don’t know if there is any way to map the table correctly.
Example of a model representing the video table.
class Video(models.Model):
id = UUIDField(db_column='ID', default=uuid.uuid4, auto=True)
titulo = models.CharField(null=False, max_length=200, db_column='DsVideo')
order = models.IntegerField(db_column='order')
The "order" field is that this in the database is as auto incrementable, but when saving, the error Can not update identity column 'order'
is returned.
@Charleschessman now looks good, because when answers come, they can help not only you, but other users of the site who don’t understand English.
– Bacco
Charles, welcome to [en.so]! Thank you for translating your question. Sorry for any friction you may have felt, but each community has its rules and the purpose of this is to provide quality content for the Portuguese speaking public. Many here understand English, but similarly there would also be no answer about puzzles on the site about code review, even if the same users are on both sites. This is essential because the goal of the network is not only to solve specific problems, but to provide a relevant knowledge base for all. Have fun!
– utluiz
Good morning, the problem is more with bank than with Django, which bank is using?
– Guilherme Nascimento