DEV Community

Discussion on: Add Some Magic to Your Django Website

Collapse
 
ashirvadz profile image
Ashirvad Zaiantchick

Hi Adam.

This is a wonderful project, thank you for creating it! I think it can help on my project. It has a sidebar, and I wanted it to have a component that is a progressbar tracking the user's disk usage on the server.

So far I have created the component successfully using django-unicorn and inserted it into the sidebar. It calculates the disk space percentage and resizes the progressbar accordingly.

Forgive my ignorance, but I can't find a way to change the component's properties outside it's class file, or from my own views.py file. Is it possible to do so? My goal is to update the component whenever there's some user action that impacts his disk usage.

Thanks!

Collapse
 
adamghill profile image
Adam Hill

Hi Ashirvad, wow that's awesome to hear that django-unicorn might be useful for your project. I haven't thought too much about this use case, but it might be doable in the future. When the user does an action would it be via some Javascript? I'm wondering if there was a hook to call from Javascript to update the component if that could work.

When you mention the views.py portion, I'm wondering if the page is going to be re-rendered altogether? In which case, I think the component just needs to get the correct data in real-time via API or database call or whatever.

In any event, if you could create a Github issue at github.com/adamghill/django-unicor..., that would be helpful for me and we can talk about your issue more in-depth.

Thanks!

Collapse
 
ashirvadz profile image
Ashirvad Zaiantchick

Hi Adam.

I have just created a Github issue.
Thanks!

Ashirvad

Thread Thread
 
adamghill profile image
Adam Hill

Here is the Github issue and my response in case it’s useful for anyone else: github.com/adamghill/django-unicor....