python - Complete table get updated instead of single row in django -
i have table named tablecolumn. , getting columnlistobj below django model api query. updated object , save it.
columnlistobj = tablecolumn.objects.get(columnone=one,columntwo=two) columnlistobj.column3 = 'some text' columnlistobj.save()
accepted behavior :
the 1 row being selected (columnone=one , columntwo=two)
should updated.
actual behavior :
complete table (columntwo='two')
update.
note: 1. columnone , columntwo combined primary key. means no duplicate. 2. tried debug , print columnlistobje after get. prints same desired row.
schema tablecolumn (please dont confuse above dummy names)
class tablecolumn(models.model): table = models.foreignkey('tablelist',primary_key=true) table_column_id = models.integerfield(primary_key=true) current_column_name = models.charfield(max_length=255) column_description = models.charfield(max_length=1024, db_column='column_description',blank=true) class meta: db_table = 'table_column'
Comments
Post a Comment