Say, you want a function that appends some data to a list. And if the list is not passed, then appends the same data to a newly created list.
What would be the obvious and naive way to go? Sure, why not use default arguments here? …
Passing a QR code as an SVG code
This tiny project will generate a QR code for any text and pass it to the HTML template as an SVG code.
SVG is a very convenient medium for URLs or other text. This small demo demonstrates a few things:
Learn by doing
We will write a Sales Orders Management System using Django REST for the back-end, and React JS for the front-end. We will add authentication with JWT and will cover the back-end with tests.
We will also use the CDN version of React JS, not the “create-react-app”. This…
Even “Senior” developers often forget to use indexes in Django. You can’t imagine how faster it can get if you simply add two lines of code into your model!
In this article we will take measurements together: with and without indexes.
Our patient will be a small Django application with…
Step by step guide to writing Tetris in Python with PyGame
In this tutorial, we will write a simple Tetris using the PyGame library in Python. The algorithms inside are pretty simple but can be a little challenging for the beginners. We will not concentrate on PyGame mechanics too much…
In almost all projects, you need to populate the database with some default data. You may also have a table with some constants that should be up to date and should be absolutely the same on all your servers, including localhost and docker.
For this, you may create migrations. Surprised…
There are things in Django that just work and you never worry about how exactly. One of these things is Sessions.
You have multiple users visiting your website. Some are logged in, some are just guests. You only need to access
request.user to see if the current user is logged…
I write programs for more than 30 years now, and for more than 15 years I teach programming in universities. I remember how I was learning to program 30 years ago, it was a completely different experience. …
In this tutorial, we will generate a PDF report and serve it to the front end.
We start by creating a Django project:
// create a Django project named pdfreport:
django-admin startproject pdfreport
// go to the new folder
// create a new environment
python3 -m venv venv
// activate this environent
Server-side rendered charts without API complications
What makes your Django project more beautiful? Charts!
In this tutorial, we will pass some statistical data to the front-end and draw the charts. …