gintas / django-picklefield

A pickled object field for Django
MIT License
180 stars 47 forks source link

problem about filter #29

Closed jingdongHe closed 5 years ago

jingdongHe commented 7 years ago

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

[] [] 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

charettes commented 5 years ago

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