gintas/django-picklefield

problem about filter

jingdongHe opened this issue · 1 comments

I got a problem when I used OBJ.objects.filter(field__exact=my_dict)
sample:

class FieldTest(models.Model):
    gene = PickledObjectField()
def check(my_dict):
    test=FieldTest.objects.create(gene=my_dict)
    print FieldTest.objects.filter(gene__exact=my_dict)
    print FieldTest.objects.filter(gene__exact=test.gene)
    print FieldTest.objects.filter()[0].gene==my_dict

when I used dict1

{'FGA': ['25', '25'], 'D13S317': ['8', '10'], 'D6S1043': ['18', '16'], 'D2S1338': ['22', '23'], 'AMEL': ['X', 'Y'], 'D3S1358': ['16', '17'], 'CSF1PO': ['12', '12'], 'D16S539': ['10', '11']}

print as

[<FieldTest: FieldTest object>]
[<FieldTest: FieldTest object>]
True

when I used dict2

{'FGA': ['25', '25'], 'D13S317': ['8', '10'], 'D6S1043': ['18', '16'], 'D2S1338': ['22', '23'], 'AMEL': ['X', 'Y'], 'D3S1358': ['16', '17'], 'CSF1PO': ['12', '12'], 'D16S539': ['10', '11'], 'TPOX': ['8', '8'], 'D21S11': ['28', '29'], 'D7S820': ['10', '11'], 'vWA': ['14', '18'], 'PentaE': ['10', '17'], 'TH01': ['7', '9'], 'D12S391': ['18', '23'], 'D8S1179': ['13', '15'], 'PentaD': ['9', '13'], 'D18S51': ['14', '19'], 'D5S818': ['19', '19'], 'D19S433': ['12', '12']}

print as

[]
[]
True

problem :dict1 and dict2 has same structure,why can not filter when used dict2

I'm afraid this is missing a bit of context to determine whether or not the current implementation is at fault here. Closing.