Django & Plotly.- Plotly Line Charts / Django Form & Template integration

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 66

  • @mattjackson7445
    @mattjackson7445 2 года назад +18

    I love how this video goes all in on useful information and cuts out the over-production common in so many RUclips videos nowadays. Thanks

    • @bugbytes3923
      @bugbytes3923  2 года назад

      Thanks for that comment, I appreciate it. I'm glad you liked the video!

  • @michaelparis6039
    @michaelparis6039 Год назад +1

    I could listen to him endlessly.

  • @Мишаня-б1м
    @Мишаня-б1м 9 месяцев назад

    Спасибо, классное видео. Стоит отметить, что грамотно использовал фишки Django и отлично изложил материал)

  • @funkiel-nowka
    @funkiel-nowka 2 года назад +2

    omg, it was that easy! 🤯
    thank you for such an easy and quick tutorial! ❤

    • @bugbytes3923
      @bugbytes3923  2 года назад +1

      No problem, glad it was useful!

  • @dodokwak
    @dodokwak 2 года назад +1

    Have been long waiting for this. Thx.

  • @manofhat676
    @manofhat676 2 года назад +3

    Thanks man, you know exactly what we need.

  • @pythonscienceanddatascienc4351
    @pythonscienceanddatascienc4351 11 месяцев назад +1

    Thanks by your video. I was looking for a video like this. Helped so much!

    • @bugbytes3923
      @bugbytes3923  11 месяцев назад +1

      Thanks a lot, glad it helped!

  • @judao1383
    @judao1383 Год назад

    Love your simplicity!

  • @jedidiahn8826
    @jedidiahn8826 2 года назад +1

    Easily the best plotly/Django integration video on RUclips! I was able to repurpose your form logic to use ModelChoiceField and filter the views by a model category. One question, though: Since the url action initiations a page refresh, how would you go about showing the applied filter on the refreshed page? In your example, the date form field clears after you hit submit so the user only knows what date range they've applied based on the chart visualization.

    • @benvees146
      @benvees146 Год назад +1

      You can pass the start and end into the context (just like the graph)

  • @lavrud112
    @lavrud112 2 года назад +1

    Thanks man! Amazing tutorial!

  • @MagnusAnand
    @MagnusAnand 2 года назад +2

    Great video as usual!!

  • @sourabhzambre2105
    @sourabhzambre2105 2 года назад +1

    gr8 tutorail...Thanks 🙂

  • @wiki-infodevelopment3369
    @wiki-infodevelopment3369 2 года назад +2

    very good tuto, many thanks ;)

  • @daviddehoog9269
    @daviddehoog9269 Год назад

    Thanks for another very helpful video ! Your explanation of the script to import the data from CSV and load it into the Django database was really clear. I was wondering if you could step through your thinking in using a custom script, rather than using Django fixtures?

  • @hardikmakwana4266
    @hardikmakwana4266 2 месяца назад +1

    Thank you bro 🎉

    • @bugbytes3923
      @bugbytes3923  2 месяца назад

      @@hardikmakwana4266 thanks for watching bro!

  • @MalekBenkouider
    @MalekBenkouider 2 года назад +1

    great video, thank you so much

  • @alexandrecosta8875
    @alexandrecosta8875 2 года назад

    thank you so much for this video :)
    still helping people!
    (love dat accent :D)

  • @dugumayeshitla3909
    @dugumayeshitla3909 2 года назад

    Wonderful content and tutorial.

  • @luizfilipedossantos7477
    @luizfilipedossantos7477 Год назад

    Awesome! Thank you!

  • @michaeloconnell8582
    @michaeloconnell8582 Год назад

    Great video!

  • @SOHAILKHAN-iu8fu
    @SOHAILKHAN-iu8fu Год назад +1

    Nice video 💯

  • @alexsferreira1973
    @alexsferreira1973 Год назад +1

    thanks so much!

  • @CallmeMrRoyal
    @CallmeMrRoyal 9 месяцев назад +1

    awesome awesome awesome

  • @TedLerios
    @TedLerios 10 месяцев назад

    Amazing video. Thank you for sharing this. Could you please explain how you would deploy an app like this. Particularly with the need to run the load_co2 script.

    • @bugbytes3923
      @bugbytes3923  10 месяцев назад

      Thanks a lot! The deployment would be normal for a Django project. If you have a script such as load_co2, you can run it as a one-off task using a cronjob on the server (or a system like Celery, for something more complex).
      I will make some general Django deployment videos in 2024, might cover the one-off script feature!

  • @jorgeav527-xyz
    @jorgeav527-xyz 2 года назад +3

    thanks for the content pls do how to create pdf reports with bootstrap images and integration with graphics

    • @bugbytes3923
      @bugbytes3923  2 года назад +1

      Thanks Jorge.
      That's an interesting question - I will look into it and hopefully do a video on this!

  • @fernandtape9363
    @fernandtape9363 2 года назад

    Thanks for this good tutorial again.
    When we have a start date, we should also have an end date? Because its not plotting without that end date.

    • @bugbytes3923
      @bugbytes3923  2 года назад

      Hey - yes, I think you might be right.
      I don't know if the form will even let you submit without an end date... you would need to pass "required=False" to the form fields within the Django form. I should probably have done this in the video!

    • @fernandtape9363
      @fernandtape9363 2 года назад

      @@bugbytes3923 I've added it, and it works. Thanks.
      I guess the next step is to add htmx ?!

    • @bugbytes3923
      @bugbytes3923  2 года назад

      @@fernandtape9363 Glad that works! You could add HTMX here to update the chart without the refresh, if you'd like - we would just need to return the Plotly chart rendered to HTML, and swap this into the DOM.

  • @redblues9566
    @redblues9566 3 месяца назад

    Thanks.

  • @peterholzer98
    @peterholzer98 Год назад

    Thanks a lot, excellent as always. Would it be possible for you to make I video about Django charting with Chart.js and how to get the data into the JavaScript (htmx?)

    • @bugbytes3923
      @bugbytes3923  Год назад +1

      Thank you! Yes, I can look at doing one with ChartJS in the near future!

  • @wiki-infodevelopment3369
    @wiki-infodevelopment3369 2 года назад

    could you please make another tuto about integration Django with plotly-dash?

  • @kodeypatterson8973
    @kodeypatterson8973 2 года назад

    I’ve been trying to implement Chart.js for like 2 days and can not get it working properly. I may give up and use plotly

    • @bugbytes3923
      @bugbytes3923  2 года назад +1

      I find it easier to do all the work in Python, personally - Plotly and Bokeh are both good options for this.
      Sometimes it does make sense to do work on the client with a JS library though - I might make some chart.js videos later on!

    • @redrum4486
      @redrum4486 2 года назад

      haha same bro, chart.js is giving me a headache and then i found this video, implemented it into my model query and it worked like a charm! Jquery/Ajax and chart.js are a bitch heh

  • @redrum4486
    @redrum4486 2 года назад

    I keep getting Object of type Product is not JSON serializable but i'm using the same code as you, all i've changed is the query set to demand=Demand.objects.all() and the x and y loop in fig variable :/

    • @redrum4486
      @redrum4486 2 года назад +1

      turns out in my Demand model, i have product_id which is a Foreign key to the Product model... and I was trying to plot product id against quantity. If I changed the product_id to a field within the Demand model that wasn't a Forieign key it worked!

    • @bugbytes3923
      @bugbytes3923  2 года назад +1

      @@redrum4486 Ah - Glad to hear it's working and you figured that out! This type of thing has caught me out quite a few times, too.

    • @redrum4486
      @redrum4486 2 года назад +1

      @@bugbytes3923 trial and error is the way xD

  • @k1k2k3k4
    @k1k2k3k4 Год назад

    Really nice video. However, I used the to_html( ) to render the plotly graphs and it is a complete killer of website performance. Is there any way to use it without making the webpage super slow to load?

  • @daveskerrett7225
    @daveskerrett7225 2 года назад

    I great tutorial, I have not been able to get the code to run though. in the load _co2.py it shows an in ' from core.models import CO2' cannot find core. I have the same file structure.
    any help would be great

    • @bugbytes3923
      @bugbytes3923  2 года назад

      Hey Dave, thanks for your comment. A couple of things:
      1. Do you have an __init__.py file in the "commands" directory?
      2. The structure, within the "core" app, should be:
      core/management/commands/load_co2.py
      core/management/commands/__init__.py
      If the import is still not working, then have you maybe created an app with a different name? If the models are not defined in an app called "core", you'd need to change the import.
      If you have anywhere I can look at the code, I'd be happy to help. I suspect it's something like the above though, as it's happened to me before too!

    • @daveskerrett7225
      @daveskerrett7225 2 года назад

      @@bugbytes3923 Thankyou very much for the quick response. I do have the _init_py in the commands folder. I started with your setup project from git and when I could not get it to work with the core,models I downloaded the finished project and still got the same error. I have not changed the code in anyway. The imports show it correctly but it throws the error when i run load_co2 I really apreciate your support