Django Select2 Tutorial | Django Dropdown | Django ajax Dropdown | Django Search and Filter

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024

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

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

    25:12 -- Fix
    Change to :
    elif self.instance.pk:

  • @rashedmazumder2522
    @rashedmazumder2522 3 ปีที่แล้ว +2

    Great video. Spent countless hours trying to find a good autocomplete. This video saved me.....

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Glad it helped..keep going👍🏻👍🏻👍🏻

  • @user-ru4zh3td7y
    @user-ru4zh3td7y 2 ปีที่แล้ว +1

    I was trying to solve my problem for 2 days until I found this video. The explaination was just brilliant. Well done and thanks!

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Glad it helped!

  • @Kennerdoll
    @Kennerdoll 2 หลายเดือนก่อน

    you made it simple for me great job bro

  • @gulshairbutt3860
    @gulshairbutt3860 2 ปีที่แล้ว +1

    Thank you so much. I was just customising the ModelForm in admin and it worked just perfectly fine.

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Great!

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

    Thanks, great video! Well explained and shown at a good pace!

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Glad it was helpful!

  • @paulohsgoes1959
    @paulohsgoes1959 3 ปีที่แล้ว +1

    Excellent jog. You've just gotten a new subscriber.

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Thanks a lot❤️

  • @williamlemosdevargas253
    @williamlemosdevargas253 2 ปีที่แล้ว +1

    thanks, it helped me with a problem at work

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Welcome😊

  • @bobs123123
    @bobs123123 4 ปีที่แล้ว +1

    Thank you ! this video helps a lot

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Glad it helped!

  • @muzaffartillaev718
    @muzaffartillaev718 3 ปีที่แล้ว +1

    Thank you! Great video!

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Glad it helped!😊

  • @tariksnet
    @tariksnet 2 ปีที่แล้ว +1

    Great video, thanks.

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Glad you liked it!

  • @tristanescaba5530
    @tristanescaba5530 4 ปีที่แล้ว +1

    Thanks! well explained!

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Glad it was helpful! Please share to your circle too... :)

  • @MotorbreathcL
    @MotorbreathcL 3 ปีที่แล้ว +1

    Thank you so much!

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Glad to help😊

  • @escalonajordana2090
    @escalonajordana2090 2 ปีที่แล้ว +1

    excelent!!

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Thanks 🤗

  • @khadimhusen
    @khadimhusen 4 ปีที่แล้ว +1

    Good tutorial.

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Glad it was helpful! Keep supporting brother... :)

  • @convenienciadigital1129
    @convenienciadigital1129 2 ปีที่แล้ว +1

    very good

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Thanks😊

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

    Great video! Quick question, can we use this in formset?

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

      Thanks, and of course you would be able to integrate it with formset with some tweaks :)

  • @asgeralia8802
    @asgeralia8802 11 หลายเดือนก่อน

    Sir superb, but i want in employee form having coutry from country tbl, blood group, department from dpt tbl, section, designation from desig tbl and etc. Can pls explain. And this not download

  • @uberdamcavaletti
    @uberdamcavaletti 2 ปีที่แล้ว +1

    HI, it is possible to make query_set filter in non Admin forms, when the user press key in select ?

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Yeah, you can make use of onchange event listener to the select element.

  • @ranjeetmishra9031
    @ranjeetmishra9031 3 ปีที่แล้ว +1

    Thanku sir

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Thanks a lot😊

  • @sassydudes5590
    @sassydudes5590 2 ปีที่แล้ว +1

    Hey brother
    I'm working on a project where I have a model name Book and inside it I've one field called Author, this author is many to many field so which just like in this video you've language which is getting its field fron language model, it is same in my project.
    I want to get authors for book upload form from authur model,
    Now what I want to do is when we have new author then rather than manually crating that author in authur table in admin pannel I want to add it through selecte2 plugin
    Can you can tell Me how can I do it
    Now I what I want to do is When I click on

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      docs.djangoproject.com/en/4.1/topics/db/examples/many_to_many/
      The docs has so much info. on this relationship and its almost the same example they are taking.

  • @nikhilrizal3729
    @nikhilrizal3729 3 ปีที่แล้ว +2

    How to if we have more than one , I tired is not working please show us or is there any documentation

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      It should've worked.... even in the case of two fields...
      You might have got the idea from the video itself on how to do that... Also you can consult Select2 and Django Docs...

  • @mfsdrawings8600
    @mfsdrawings8600 4 ปีที่แล้ว +1

    Nice

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Thanks 😊

  • @marioa1838
    @marioa1838 2 ปีที่แล้ว +1

    Thank you! it worked. But now, I am wondering what I've got to do if I want two select2 fields in the same form. It probably has something to do in the views.py file, right? Along the lines of if #buttonid is clicked, then this term search, if #buttonid2 is clicked then this, right? but ive got no idea

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      Sorry for the late reply...
      Yeah, you can do that by tweaking views.py and the frontend.

  • @solques36
    @solques36 3 ปีที่แล้ว +1

    Could u tell me the method to do if i had a search bar instead using only How would i implement the select 2 for this?

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      The better way to do that will be using another library called jQuery UI..I have done a video on that too...
      th-cam.com/video/-oLVZp1NQVE/w-d-xo.html
      Also, refer this stackoverflow question for more info...
      stackoverflow.com/questions/20223044/select2-start-with-input-field-instead-of-dropdown

  • @Samuelnois
    @Samuelnois 2 ปีที่แล้ว +1

    Ei, bro. How do I implement with CreateView ? I can't make it to the second part with createview

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

      Sorry for the late reply....
      Is this fixed ?

    • @Samuelnois
      @Samuelnois 2 ปีที่แล้ว +1

      @@CodeBand yes. Thanks

  • @travelfreak1246
    @travelfreak1246 2 ปีที่แล้ว +1

    'WSGIRequest' object has no attribute 'is_ajax' this is my error. please answer me..

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

      groups.google.com/g/django-users/c/5x-qF0Q5Xi8?pli=1

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

    How to do it in a many to many relationship, with multipleselect?

  • @coastallivestream7117
    @coastallivestream7117 4 ปีที่แล้ว +1

    next video on tinyMCE PLEASE

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Thanks for the suggestion, I will definitely look into that in a future video.

  • @vinayyadav2036
    @vinayyadav2036 3 ปีที่แล้ว +1

    how can we filter data for ManyToManyFields ?

  • @imouranasavane1054
    @imouranasavane1054 4 ปีที่แล้ว +1

    Thanks lot, your video helps lot. I have a form with two fields to be completed with different Foreinkey(email, employee department), could you help me. Please

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Thanks :) The process is pretty much the same with even two foreign key fields. You may different options like you can make different ajax requests and url paths for those two foreign key fields OR you can use the same one and differentiate them in the function.

  • @DimitrisKougioumtzis
    @DimitrisKougioumtzis 2 ปีที่แล้ว +1

    how to add select2 widget in django admin tabular inline form ?

    • @CodeBand
      @CodeBand  2 ปีที่แล้ว +1

      stackoverflow.com/questions/68084590/how-to-use-django-select2-widgets-in-django-admin-site

  • @ayubkara1092
    @ayubkara1092 2 ปีที่แล้ว +1

    can you show us how to use select2 with django_filters

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

      Will try to do a video on it, meanwhile try digging into docs and figure it out...

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

      @@CodeBand will do , Thanks

  • @KrishnaManohar8021
    @KrishnaManohar8021 4 ปีที่แล้ว +1

    How e-commerce websites do currency converter. When I select USD the price shown in $, when I click INR price shown in rupees. How? How?

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      There are a lot of API's available out there to do the conversion.
      Thanks.. :)

    • @KrishnaManohar8021
      @KrishnaManohar8021 4 ปีที่แล้ว +1

      @@CodeBand bro push any tutorials for that. May be it trending topic 🤔

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Will think about that...anyway a great idea :)

    • @KrishnaManohar8021
      @KrishnaManohar8021 4 ปีที่แล้ว +1

      @@CodeBand I already give u DRF & JwT tutorials, still your not implemented 😟

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      @@KrishnaManohar8021 Will definitely post them in the near future, Little bit busy now a days, pardon me.

  • @codedjango
    @codedjango 4 ปีที่แล้ว +1

    How about multiple select instead? for m2m relationships?

    • @CodeBand
      @CodeBand  4 ปีที่แล้ว +1

      Bro, its pretty much the same concept with little tweaks, if you see the whole video, then probably, you could definitely do the multiple select as well.
      Thank you.

    • @codedjango
      @codedjango 4 ปีที่แล้ว +1

      Ok i will try

  • @walterrandazzo6399
    @walterrandazzo6399 3 ปีที่แล้ว +1

    Hi guys, How to use it with Boostrap?

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +2

      Please go through this link...
      stackoverflow.com/questions/36132875/how-to-use-select2-bootstrap

    • @xlsautomatizaciones9197
      @xlsautomatizaciones9197 3 ปีที่แล้ว +1

      @@CodeBand Thanks bro, keep doing this!

    • @CodeBand
      @CodeBand  3 ปีที่แล้ว +1

      Glad to hear that..😊😊

  • @rdarktemplar1989
    @rdarktemplar1989 3 ปีที่แล้ว +1

    nonsense...