[Django]-Django error: Invalid column name 'id'

5👍

According to django docs, the id column is created automatically. This behavior can be overridden by specifying another attribute as the primary key in the Model subclass:

class ReportTemplate(models.Model):
    name = models.TextField(db_column='Name', blank=True, primary_key=True)
    template = models.TextField(db_column='Template', blank=True)

    class Meta:
        db_table = 'ReportTemplateTbl'
👤Bryan

Leave a comment