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

Howto make daemon in Python 3

In one of my Python project I needed to run any Python code in the background, therefore, I have created this code snippet for easy making a Python daemon. The code was tested and used with Python 3.5 up 3.9 and usage is very straightforward. You just have to create the subclass of  daemon class … Read more