Build a dynamic filtering form with Django // 7 - Filtering by category and review

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2024

ความคิดเห็น • 23

  • @MrValVet
    @MrValVet ปีที่แล้ว

    You are my fave Django TH-camr. Thanks!

  • @parukutty-p8l
    @parukutty-p8l ปีที่แล้ว

    awesome explanation sir

  • @janzsobence
    @janzsobence 3 ปีที่แล้ว

    It's a high quality content. Thank you!

  • @helio4327
    @helio4327 3 ปีที่แล้ว

    Muito top, seu tutorial me ajudou a resolver um problema de 1 mês show demais. Ganhou 1 inscrito.

  • @cmldk
    @cmldk 5 ปีที่แล้ว +1

    Thank you so much!

  • @PyLenin
    @PyLenin 4 ปีที่แล้ว

    Use "selected disable" for the category

  • @astrocat131
    @astrocat131 4 ปีที่แล้ว

    Thanks, it helps me

  • @CA_Sandeep_Modi
    @CA_Sandeep_Modi 5 ปีที่แล้ว

    Thank you so much! god bless you

  • @lucastavares4908
    @lucastavares4908 5 ปีที่แล้ว

    awesome video!!

  • @ruddha2
    @ruddha2 3 ปีที่แล้ว

    Nice!

  • @ZulfikriAman
    @ZulfikriAman 5 ปีที่แล้ว

    Nice! Thanks.

  • @kelvinhuang4164
    @kelvinhuang4164 ปีที่แล้ว

    what about just refresh table content after click the search button?just like ajax request

  • @MrBrunoPING
    @MrBrunoPING 2 ปีที่แล้ว

    Hi! I used your filter scheme in an application, but I'm having trouble paginating the Results. Can you help me?
    Thank you for your videos, your channel is excellent and has great content!

  • @parukutty-p8l
    @parukutty-p8l ปีที่แล้ว

    sir everything is working perfecting up to this video but the category filter not., even we are getting the value from drop down to back end ,but it keep saying the field is empty or other words its not filtering

  • @Boga_adventures
    @Boga_adventures 4 ปีที่แล้ว

    thanks alot man

  • @janicesombillo8147
    @janicesombillo8147 4 ปีที่แล้ว

    can we use ajax here?

  • @deezedpotato
    @deezedpotato 5 ปีที่แล้ว

    Bro after this series do Django with angular 😍

  • @DemonDraKe682
    @DemonDraKe682 3 ปีที่แล้ว

    Reviewed and not reviewed should be excluyent options but like this the user can select both and search

  • @HK-xh5qz
    @HK-xh5qz 4 ปีที่แล้ว

    Thank you for the fantastic tutorial.
    All was working fine, but if I open the site new without parameters an error occurs: "Cannot use None as a query value".
    Do you have a solution for that problem? Thanks

    • @johannesn18
      @johannesn18 4 ปีที่แล้ว +2

      When you open a new site, the view runs the "request.GET.get()" which returns None because no form was submitted.
      one way to fix this is to create another view for the new site:
      views.py
      class PostListView(ListView):
      # home view that contains the search form
      model = Post
      template_name = 'erf24/home.html' # /_.html
      context_object_name = 'posts' # default >> erf24/post_list.html
      ordering = ['-date_posted']
      paginate_by = 3
      def is_valid_queryparam(param):
      return param != '' and param is not None
      class SearchView(ListView):
      # home view that contains search results
      # model = Post
      template_name = 'erf24/home.html' # /_.html
      context_object_name = 'posts' # default >> erf24/post_list.html
      ordering = ['-date_posted']
      paginate_by = 3
      def get_queryset(self): # new
      key = self.request.GET.get('key')
      minp = self.request.GET.get('min')
      maxp = self.request.GET.get('max')
      mind = self.request.GET.get('start')
      maxd = self.request.GET.get('end')

      if is_valid_queryparam(key):
      obj = Post.objects.filter(Q(content__icontains=key) | Q(location__icontains=key)).distinct()
      if is_valid_queryparam(minp):
      obj = Post.objects.filter(Q(price__gte=minp)).distinct()
      if is_valid_queryparam(maxp):
      obj = Post.objects.filter(Q(price__lte=maxp)).distinct()
      if is_valid_queryparam(mind):
      obj = Post.objects.filter(Q(date_posted__gte=mind)).distinct()
      if is_valid_queryparam(maxd):
      obj = Post.objects.filter(Q(date_posted__lte=maxd)).distinct()
      return obj
      urls.py
      urlpatterns = [
      path('', PostListView.as_view(), name='home'),
      path('search/', SearchView.as_view(), name='home-search'),
      ]

  • @ExplaineRKhaN
    @ExplaineRKhaN 5 ปีที่แล้ว

    sir i m your student i have problem i want to develop youtube like ads on video.
    how to embed run time ads in video ,
    for example banner ads skip ads .
    thank you sir