Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Cómo ordenar la consulta GET de acuerdo con las reglas especificadas

Estoy usando url_replace para agregar una consulta GET como se muestra a continuación.

 @register.simple_tag def url_replace(request, field, value): get_params = request.GET.copy() get_params[field] = value return get_params.urlencode() <p>[ Category ]</p> <ul> {% for cat in cats %} <li><a href="?{% url_replace request 'category' cat.slug %}">{{ cat.name }}</a></li> {% endfor %} </ul> <p>[ Job Type ]</p> <ul> {% for type_value, type_name in types %} <li><a href="?{% url_replace request 'type' type_value %}">{{ type_name }}</a></li> {% endfor %} </ul>

Organiza la consulta GET cada vez que hace clic en el enlace especificado. Por ejemplo:

 1) current URL: /jobs/ click <a href="?{% url_replace request 'category' cat.slug %}">{{ cat.name }}</a> URL changes: /jobs/?category=cat.slug then click <a href="?{% url_replace request 'type' type_value %}">{{ type_name }}</a> URL changes: /jobs/?category=cat.slug&type=type_value 2) current URL: /jobs/ click <a href="?{% url_replace request 'type' type_value %}">{{ type_name }}</a> URL changes: /jobs/?type=type_value then click <a href="?{% url_replace request 'category' cat.slug %}">{{ cat.name }}</a> URL changes: /jobs/?type=type_value&category=cat.slug

Pero quiero ordenar estas consultas GET siempre primero por categoría y luego por tipo.

 always: /jobs/?category=cat.slug&type=type_value not: /jobs/?type=type_value&category=cat.slug

¿Cómo puedo hacer esto?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!