#100DaysOfCode Day 17: Dumbfounded by a simple problem

By / Published UTC

I finished working on all the logic and templates of this page you're reading!

Everything went pretty smoothly, except for one thing.

You know the progress bar on the main #100DaysOfCode page? Damn, making that work had me dumbfounded for quite a few hours.

Basically, I tried to add a paramater to my context to pass in the most recent log, check how many days in I was, and set the progress bar according to that. But here's where the issue arose: For some reason, even though there were no syntaxerrors or any errors being called out by Django, the progress bar wasn't setting to the right amount. In fact, it wasn't getting the day value from the most recent post at all!

This really got me, and I was honestly at a loss for the next few hours.

Then, I cracked the code! The issue was that I was passing a queryset (set of objects in Django), and not a single log object, meaning I had to do a for loop to get the item out (even though there was only one). After I worked that out, boom! It worked!

Deployment was smooth as ever. No hiccups. And now it's live!! Yay! What do you think? 😃

I'll send you weekly updates on my #100DaysOfCode as well as normal blog posts if you sign up.

Subscribe to the mailing list - never miss a post.

* indicates required

This is an advertisement.


Copyright 2019 Lumiobyte/Cockatoo Development Studios. All Rights Reserved.