Pagination Bug Fix in Customer Relationship Management System
Pagination Bug Fix
When setting list_per_page = 2 in king_admin.py, a bug appears when clicking the "Next" page button.
Click "Next":
The bug results in the following error:
The root cause is that the anchor (<a>) tag for the "Next" page in the frontend uses a link like:
Here, page=2 is treated as a query ...
Posted on Fri, 02 Oct 2026 16:33:05 +0000 by 947740
Safe In-Place JSON Patch Without External Dependencies
Often you only need to change one leaf value inside a JSON file while leaving every sibling intact. Below are the practical patterns that achieve this in pure Python, followed by a lightweight helper that keeps the code footprint minimal yet avoids the "load-modify-dump everything" anti-pattern.
Quick Motivating Example
{
"name ...
Posted on Fri, 02 Oct 2026 16:30:16 +0000 by Taneya
Essential Python Syntax: I/O Operations, Data Structures, Functions, Classes, and Error Handling
Input and Output Operations
Reading Keyboard Input
To read input from the keyboard, use the input() function which reads a line of text:
user_input = input("Please enter something: ")
print("You entered: ", user_input)
File Operasions
To work with files, you need to open them first:
# Using context manager (recommended)
wit ...
Posted on Fri, 02 Oct 2026 16:26:10 +0000 by Hiro
Working with Python Lists and Tuples
A list is an ordered, mutable collection that can hold elements of any type, including other lists.
Creating Lists
Lists can be created through direct definition, for loops, and list comprehensions.
Direct Definition
Use square brackets [].
sample_list = [1, 2, 'hello', [3, 4], (5,), {'data': 100}]
Using a For Loop
num_list = []
for j in range ...
Posted on Fri, 02 Oct 2026 16:10:08 +0000 by leap500
Database Migration Management with Flask-Migrate
Flask-Migrate is an extension that integrates Alembic into Flask applications, enabling tracking of model changes and mapping them to the database.
Install Flask-Migrate via pip:
pip install flask-migrate
A typical project structure includes:
config.py
app.py
manager.py
models.py
Define database configuration in config.py:
class Config:
...
Posted on Fri, 02 Oct 2026 16:05:46 +0000 by TWD
Generating Beautiful Test Reports with Pytest and Allure
Introduction
The Allure Framework is a lightweight, flexible, multi-language test reporting tool. It presents test results in a clean web-based format and helps everyone involved in the development process extract meaningful information from daily test executions.
From a development and testing perspective:
Allure reports enable quick identific ...
Posted on Thu, 01 Oct 2026 16:45:15 +0000 by redsox8185
Implementing Login Authentication with Flask-HTTPAuth and PyJWT in Python
This guide covers using Flask-HTTPAuth and PyJWT to implement token-based login authentication in a Flask application.
Install Dependencies
First, install the required packages:
pip install Flask-HTTPAuth pyjwt passlib
Flask-HTTPAuth documentation
PyJWT documentation
Passlib documentation
Verify Token Implementation
The following code demons ...
Posted on Thu, 01 Oct 2026 16:08:36 +0000 by wazza
Integrating WTForms for Validation in Tornado Applications
Prerequisites and Installation
To begin implementing form validation, install the necessary packages. The core library is WTForms, but since we are integrating with Tornado, we also need the adapter bridge.
pip install wtforms wtforms-tornado peewee pymysql
Database Configuration and Model
We will define a UserFeedback model using the Peewee ...
Posted on Wed, 30 Sep 2026 16:56:13 +0000 by Rayhan Muktader
Mastering Python Essentials: Variable Swapping, F-Strings, Formatting, and Slice Notation
Swapping Variable Values
Python provides elegant ways to exchange values between variables. simplest approach uses tuple unpacking, which works for any number of variables as long as both sides of the assignment have the same count.
x_val = 11
y_val = 7
x_val, y_val = y_val, x_val
print(x_val) # 7
print(y_val) # 11
Arithmetic Swap (Number ...
Posted on Wed, 30 Sep 2026 16:49:23 +0000 by climbjm
Essential Python Libraries for Modern Development
Pendulum
For handling date and time operations in Python, Pendulum stands out as a powerful alternative to the standard library. It enhances datetime functionality with an intuitive interface for timezone management and temporal calculations.
Installation
pip install pendulum
Usage Examples
Creating DateTime Objects
import pendulum
dt = pendu ...
Posted on Wed, 30 Sep 2026 16:45:49 +0000 by enfys