Howto build Django form with Ajax and Boostrap 4

HTML forms belong among basic components of almost any website or web application. Earlier or later you as a Django developer are going to be challenged to code some Django forms mostly advance ones and because of that, you need to understand how using Django forms. In a real-life scenario, you will have to deal … Read more

Howto make upload form and process image in Django

Hi everyone, i will show you how to create upload form to upload the file, we will generate a thumbnail and show it on the website. To generate thumbnails I will use popular module Pillow. # the content add to your urls.py urlpatterns += [path(‘upload-form/’, uploadapp.views.upload, name=”upload”)] I will create a model of an upload … Read more

Howto send html email with embedded image in Django

Hi everyone, here is another Django tip, a small snippet of code for sending HTML email with an embedded image. This code also handles plain text variant of email. That is all and as always, any improvement ideas are welcomed. Enjoy! Hanz from pathlib import Path from email.mime.image import MIMEImage from django.core.mail import EmailMultiAlternatives recipient … Read more

How to create Python 3.x daemon

In one of my Python projects, I needed to run any Python code in the background, thus I wrote this code snippet to make it simple to create a Python daemon.The code was tested and used with Python 3.5 to 3.11 and its usage is very straightforward. Simply create a subclass of the daemon class, … Read more