[Fixed]-How to compare two string on template in django?

1👍

This is always failing because trans_his.trans_type is not an string but a unicode or an object that stringifies in Debit. If you really want to compare them, first convert this varaible trans_his.trans_type into string in your views by :

trans_his.trans_type = str(trans_his.trans_type)

And then compare it. Other wise use :

<td>{{ trans_his.trans_type }} {{ data.amount }}</td>

as Suggested by Anonymous.

Leave a comment