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

294
Views
How to pass parameters to ListView?

How to pass variables (min_amount and max_amount) from done() to SearchAdvertResultView(ListView)?


done() method of some object:

def done(self)
    ...
    min_amount = 100
    max_amount = 500
    return redirect(reverse('board:search-result'))

urls.py:

...
url(r'^results$',
    SearchAdvertResultView.as_view(),
    name='search-result',
    ),
...

views.py:

...
class SearchAdvertResultView(ListView):
    template_name = "board/search_results.html"

    def get_queryset(self):
        ...
        return Adverts.objects.filter(amount__range=(min_amount, max_amount))
...
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

def done(self)
    ...
    min_amount = 100
    max_amount = 500
    urlparams = '?min_amount=%s&max_amount=%s' % (min_amount, max_amount)
    return redirect(reverse('board:search-result')+urlparams)

class SearchAdvertResultView(ListView):
    template_name = "board/search_results.html"

    def get_queryset(self):
        ...
        min_amount = self.request.GET.get('min_amount')
        max_amount = self.request.GET.get('max_amount')
        return Adverts.objects.filter(amount__range=(min_amount, max_amount))
over 4 years ago · Santiago Trujillo Report
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!