CMS Development

diavolino
Participante

HubL - query_dict - get keys and values

resolver

hi all

 

if i print the query_dict i would get this:

{yr=2014, onoff=0}

 

i would like to get the keys as well as the values for further use but manage only to get the values. how could i read the key's?

1 | yr | 2014
2 | onoff | 0

 

unfortunately this did not work:

{% for key, value in request.query_dict %}
  {{ loop.index }} | {{ key }} | {{ value }}<br>
{% endfor %}

1 Soluciones aceptada
stefen
Solución
Asesor destacado | Partner
Asesor destacado | Partner

HubL - query_dict - get keys and values

resolver
6 Respuestas 6
stefen
Asesor destacado | Partner
Asesor destacado | Partner

HubL - query_dict - get keys and values

resolver

@diavolino I think you forgot the ".items()". Try this:

{% for key, value in request.query_dict.items() %}
  {{ loop.index }} | {{ key }} | {{ value }}<br>
{% endfor %}
Stefen Phelps, Community Champion, Kelp Web Developer
LPM
Colaborador líder | Partner nivel Diamond
Colaborador líder | Partner nivel Diamond

HubL - query_dict - get keys and values

resolver

Thanks @stefen , that worked. Is there no documentation on this anywhere? The only reference I found on the hubl documentation is for the general request.query_dict term.

0 Me gusta
stefen
Solución
Asesor destacado | Partner
Asesor destacado | Partner

HubL - query_dict - get keys and values

resolver
LPM
Colaborador líder | Partner nivel Diamond
Colaborador líder | Partner nivel Diamond

HubL - query_dict - get keys and values

resolver

Ahh yes, I missed the ".items()" part. Too used to other languages not having it!

 

Thanks a lot!

0 Me gusta
LPM
Colaborador líder | Partner nivel Diamond
Colaborador líder | Partner nivel Diamond

HubL - query_dict - get keys and values

resolver

Can confirm, this only returns the values, not the keys

0 Me gusta
roisinkirby
Equipo de producto de HubSpot
Equipo de producto de HubSpot

HubL - query_dict - get keys and values

resolver

Hey @diavolino are you still having difficulty? Are you able to select deal stage before creating a new deal?

0 Me gusta