11 ms·
Thank for the quick reply. Now I need to understand how the "__" magic work; And I wonder what would django do if my key is "animal__breed". Will it understand
by oneweekwonder 8y ago
Thank for the quick reply. Now I need to understand how the "__" magic work; And I wonder what would django do if my key is "animal__breed".
Will it understand:
Dog.objects.filter(data__animal__breed='collie')
But this is maybe questions I should rather ask on #django or stackoverflow.
- strig 8y agoDjango won't let you name a model field with a double underscore, I believe. Not sure how this would work with a Postgres JSON type column though, but it would probably throw an error.
- akx 8y agoYou probably simply can't do a `data['animal__breed']` query (not with that syntax anyway; you can implement custom lookups though) if your key happens to contain a double underscore.