class dbview(models.Model):
# field definitions omitted for brevity
class Meta:
db_table = \'read_only_view\'
def main(request):
result = dbview
There should have been an auto-generated id
field when you ran syncdb
(if there is no primary key defined in your model, then Django will insert an AutoField
for you).
This error means that Django is asking your database for the id
field, but none exists. Can you run django manage.py dbshell
and then DESCRIBE read_only_view;
and post the result? This will show all of the columns that are in the database.
Alternatively, can you include the model definition you excluded? (and confirm that you haven't altered the model definition since you ran syncdb
?)