Automating the Boring Stuff in Django Using the Check Framework
A guide to using Django's check framework and Python's ast module to automate custom code quality and style enforcement, like ensuring model fields have verbose names.
Haki Benita is a software developer and technical lead specializing in databases, web development, software design, and performance tuning. He shares insights through interviews, trainings, and talks, and occasionally offers consultancy and contract work.
59 articles from this blog
A guide to using Django's check framework and Python's ast module to automate custom code quality and style enforcement, like ensuring model fields have verbose names.
Practical tips for optimizing Django database interactions, covering aggregation filters, namedtuples, and custom functions.
A guide to creating a custom text input filter for Django Admin to improve performance over standard search fields.
Analyzing and solving a performance issue in Django Admin's date hierarchy filter with large datasets and PostgreSQL.
A technical article about optimizing Django Admin's date_hierarchy feature to eliminate performance bottlenecks caused by expensive database queries.
A technical article about using a Python context manager to simplify testing with feature flags, replacing numerous test fixtures.
Explains concurrency issues in Django models and demonstrates solutions using pessimistic locking with select_for_update to ensure data integrity.
Five practical security and usability improvements for the Django Admin interface, including URL changes, environment indicators, and 2FA.
Explores the various uses of the DISTINCT keyword in PostgreSQL, including DISTINCT ON, with practical SQL examples.
A technical guide explaining how to use Django's prefetch_related to solve the N+1 query problem and optimize database performance.
A tutorial on customizing Django Admin to create a simple dashboard with summary tables and charts, using proxy models and template overrides.
A guide to effectively testing Django signals, covering decoupling, signal creation, and best practices for writing clean, maintainable tests.
A guide to building a robust Python API client for a payment gateway, covering error handling, logging, and best practices.
Explains the unittest.subTest feature in Python for better test iteration reporting and debugging.
A guide to identifying and reporting slow-running tests in Python's unittest framework by implementing custom timing logic and a custom TestRunner.
A tutorial on adding custom action buttons (deposit/withdraw) to the Django admin interface, including form handling and email notifications.
A technical guide on designing robust Django models for a bank account system, covering constraints, logging, and best practices.
A guide to using class-based tests in Python to make test suites more extensive, expressive, and maintainable, demonstrated with an API login endpoint.
Optimizing Django Admin performance for large-scale applications by addressing common issues like the N+1 query problem and database load.