Based on the post: Django comparing model instances for equality
I am trying to remove the duplicates from my list of instance (Which have not been saved yet and I assume their 'id' to be None)
the code is:
a = list()
a.append(relation_list.pop())
for x in relation_list:
    duplicate = False
    for z in a:
        if z is x:
        #or if z.attrib1 == x.attrib1 and z.attrib2 == x.attrib2:
            duplicate = True
    if not duplicate:
        a.append(x)
However, given the attribs being equal the line duplicate = True never get executed.
What am I missing?
Is there a more efficient way to achieve this? (inspired from this post using "in relation_list" either does not work.
 
    