I am trying to display my mysql data on a HTML page everything is working fine but when i try to display the data from mySQL tohtml page its showing 1054, "Unknown column 'work_waterlevel.id' in 'field list'") this error how to resolve this error my models.py is
from django.db import models
# Create your models here.
class waterlevel(models.Model):
time=models.DateTimeField()
status=models.CharField(max_length=50)
level=models.DecimalField(max_digits=12,decimal_places=6)
the traceback is as follows
File "C:\Users\siddhant\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\siddhant\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\siddhant\AppData\Local\Programs\Python\Python39\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
res = self._query(query)
File "C:\Users\siddhant\AppData\Local\Programs\Python\Python39\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
db.query(q)
File "C:\Users\siddhant\AppData\Local\Programs\Python\Python39\lib\site-packages\MySQLdb\connections.py", line 259, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1054, "Unknown column 'work_waterlevel.id' in 'field list'")
its showing i have error in my view.py file my view.py file is as follows
def generate(request):
b=request.POST['level']
a=request.POST['status']
output=run([sys.executable,'C:\\Users\\siddhant\\Desktop\\internship\\indicator\\work\\water.py',b,a],stdout=PIPE,text=True)
event_list=waterlevel.objects.all()
return render(request,'result.html',{'event':event_list})
anyone can suggest how I can send my MySQL data to the result.html page