Django – Comparing id of queryset with fetch object id

  django, django-models, django-queryset, python

I am learning django with practicing. I have one object. It has id, name, lastname. Also, I have one queryset. It has same attributes id,name, lastname. All I want is comparing id’s. I can compare ids if they both are equal but my problem is if they both are not equal django gives me error like

matching query does not exist.

because I use filter function.

I want to do this operation

            if icformkeyinput.filter(id=v['Id']):
            if icformkeyinput.filter(id!=v['Id']):

My problem is How can I use != operator?

I want to do this because if there is unmatched id between icformkeyinput and v then add v to icformkeyinput.

Source: Python Questions