This blog is quite different from other blogs that I had posted. Instead of talking about a specific technical topic, what I want is to share my experience in solving a particular business problem with AI (or not AI) based solution and the decision that led to the final implementation.

The problem I wanted to solve was to improve the matching rate of shipment records to their PeriShip account IDs. This is a crucial function in our operational system. It impacts all the “down line” functions in our system. In this actual implementation, this functionality was written in a group…


Django is one of the most popular Python Web framework. It is designed based on the “model-template-view” pattern. In Django, the Model is acting as the interface to the data (Database). As each model is associated with each physical table in database, I start wondering if it’s possible to make ORM deal with more advanced database feature, that is view and materialized view. The result turns out to be more than great!

View and materialized view are results of lookup SQL query. The main difference between them is that materialized view stores result as an actual table while view does…


In the previous article, we’ve went through a basic tutorial on how to use React.js in Django. It mainly focuses on front-end and has little connection to Django view. I know it’s not enough. Here comes the hard way.

In this article, we are going to dig into a common feature in web application — form submission. The Django conventional way is to build form in backend and render it in a main template. Add JS code if you need some interactions between user and GUI. The downside is that if form GUI is complex, front-end codes can be very…


I’ve been looking for a great front-end library to fit into Django for years. The problem is that UI requirements have been growing so tremendously that the conventional tech stack (Django template engine + Bootstrap + Vanilla JavaScript) does not meet the pace of modern web development anymore. After I have been researching and using different libraries in many projects, JQuery, React JS and Vue JS seems to be the top-tier choices. Among them, React JS definitely catches my eyes. Leveraging its component-based development, we can scale our UIs in a time-efficient manner with minimum maintenance effort. …


Summary

In this article, I am going to present my approach to design Django Templates in the Django application development. The objective is to keep the UI part of Django application better organized and avoid redundant coding. Django has provided various mechanisms in template engine to help us achieve such goal. In this tutorial, I will walk you through how to make templates easy to maintain as much as possible by using Django built-in template tag block, extends and include.

Dependencies:

1. Python 3.6

2. Django 2.2

3. AdminLTE 3.0.5 (You can check my previous tutorial on this theming library here.)

Preview: Bad architecture of templates

I’ve…


Have you thought about how much users like your website? How often do they log in? What’s the favorite time window they use your website? These million-dollar questions are big deals to business. The activity of sign in/out seems to be the most reliable data to answer them. In this tutorial, I am going to walk you through how to track these data in Django.

After comparing and trying a few different approaches for years, here comes to my best solution, that is Django signal which is a common design pattern: Observer Pattern. After architecting many Django projects, I noticed…


I have been doing Django Framework based design and development work for 5+ years. While the Django development is Python programming at its core, inevitably we will need the CSS/HTML/JavaScript for the presentation. When comes to the selection of CSS/JavaScript libraries, jQuery/Bootstrap combination seems to be the most popular choice. There are number of Django packages that support the jQuery and Bootstrap already. However, I have decided to go one step further that is to use a ready-made theming library. It took me awhile to find a suitable CSS/JavaScript theming library to work with our Django based project. What I…


Having been doing Python/Django development for the last 5+ years, a recurring “to do” item is to implement “Google Captcha” in the public website. Given the popularity of the Google Captcha and Python/Django, I was rather surprised that I could not find a straightforward answer on how to implement it. After some discussion with folks who have similar problems and needs, I can summarize the problem and the challenges related to implementing this feature.

In this article, I am assuming you are familiar with Django. So, I will skip the instruction on building Django project from scratch. If you would…

Yiqing Lan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store