I am using Django with mysql. I have created models.py
using command inspectdb
from existing database in mysql. It has a model as below :
class Participationdata(models.Model):
userid = models.ForeignKey('Volunteer', models.DO_NOTHING, db_column='UserId') # Field name made lowercase.
eventid = models.ForeignKey('Events', models.DO_NOTHING, db_column='EventId') # Field name made lowercase.
ptrflag = models.IntegerField(db_column='PtrFlag', blank=True, null=True) # Field name made lowercase.
class Meta:
managed = False
db_table = 'ParticipationData'
unique_together = (('userid', 'eventid'),)
I have inserted the data into database using this model successfully. But while selecting data it is showing the error like :
django.db.utils.OperationalError: (1054, "Unknown column 'Participationdata.id' in 'field list'")
How should I resolve this ?