Re: Passing an integer-only key to KeyTransform

2021-12-27 Thread Niccolò Mineo
I ended up using the JSONB_EXTRACT_PATH function (I am using Postgres), although it's a pity not to be able to use KeyTransform in this situation. Il giorno lunedì 27 dicembre 2021 alle 10:59:22 UTC+1 Mariusz Felisiak ha scritto: > Hi, > > Integers (and strings that can be cast to integers) on

Re: Passing an integer-only key to KeyTransform

2021-12-27 Thread Mariusz Felisiak
Hi, Integers (and strings that can be cast to integers) on the first-level are always interpreted as index transforms in arrays (as documented ) because you can store a JSON array in the JSONField. Unfortun

Passing an integer-only key to KeyTransform

2021-12-27 Thread Niccolò Mineo
On a Django 3.2 installation, I am trying to pass a stringified integer-only zip code as the key_name argument to KeyTransform: >>> stats_qs = stats.annotate(municipality_stats=KeyTransform("66049", "data")).values("municipality_stats") As highlighted above, it fails to work. The reason, as yo