Look, we all do it. It’s our guilty little secret as programmers. Yes, we still use the print() statement for debugging out to the console. Well now your shame can be a little prettier! Introducing the rich library! Install with… Read More »Super charge your Print statements with rich!
Recently I found the need to access a page external to my app and get the links of all the images for subsequent downloading. I found some code readily enough but it was for Python 2.7 – here is the… Read More »How to get all the image links on an external page using Python
Sometimes you may wish to raise a 404 in the middle of a class based view. Perhaps you determine in the middle of get_context_data() that you don’t want this user accessing the object for some reason. Consider a horse stable,… Read More »Raising a 404 error from a Class Based View in Django
When optimising your site for mobile, sometimes you need margins that only apply at certain screen sizes. For example I have this on the desktop size of my website HorseRecords: And on mobile it goes to this: There is no… Read More »Adding margins in Bootstrap on mobile screens only
Say you have a button that you want people to click to submit a form. Like this one: And you want to have the text change when they click the button and you are doing some form processing (like sending… Read More »Changing button text on click – as well as reducing form double clicks
Every Django Application has the magnificent Django Admin built in enabling you to access your database tables in a very nice way. The url is typically admin/ The problem is that hackers also know the default admin url for a… Read More »Securing your Django Admin by using a HoneyPot
Sometimes you have large data sets. Most of the time this makes Django slow. For example there are 17,000 suburbs in Australia – so having an address with a foreign key to suburb is going to create slowness in forms… Read More »Choose, and choose quickly: Optimising ModelChoiceField
Yes. Yes you should. There is almost no reason not to, and plenty of reasons why it’s the right choice. Background A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. When generated according… Read More »Should I use UUIDs as my model ID in Django?
A few years ago, I had the opportunity to interview people for a Senior Software Engineer role. I was dead keen to do this as I take an interest in how to interview programmers. Amongst the questions I asked, there… Read More »The interview question that stumped 30% of Senior Software Engineers