1👍
✅
Ok I see now, I think the problem is your flags model is defined with:
type_id = models.ForeignKey(Bugzilla_flagtypes,related_name='flagtype',db_column='type_id',to_field='name')`
…but in the db the type_id
column in the flags
table clearly contains the integer id
of the flagtype… in other words your model definition doesn’t match the db schema, you need to remove the to_field
from the ForeignKey above.
Then this should work:
bug.flaglines.get(type_id__name="UnlocksBranch")
Source:stackexchange.com