Python 3.8.2 contains numerous new bug fixes while 3.9.0a4 is the fourth of six planned alpha releases leading up to its planned release in August.
Django relies on community donations and now you can fund it directly via Github. Currently 40+ monthly sponsors.
A look at the two dominant ways to structure templates in a Django app.
An in-depth look at HTTP redirects and multiple ways to implement them in Django.
A guide to spotting N+1 query issues in your Django app.
The authors of Two Scoops of Django have released their latest book, the Django Crash Course. Based on their corporate training, they are offering the book for under US$20, which is a steal considering they normally charge $3000/person for in-person training. This book, currently 50 chapters long, is intended for passionate learners willing to get the latest, most cutting-edge written materials. Now in beta, the book is being updated several days a week!.
Available in E-Book format, the paperback, coil-bound, and hardcover versions are available for pre-order.
A 10-part series on testing Django and Django Rest Framework.
Django co-creator Jacob Kaplan-Moss walks through building a web framework from scratch, and the core decisions necessary along the way.
Jacinda is the co-founder of Apero Health and formerly CTO of DoctorOnDemand. The discussion covers lessons learned building both platforms from scratch and how to scale code and teams.
Auto-detecting the n+1 queries problem in Python
nplusone is a library for detecting the n+1 queries problem in Python ORMs, including SQLAlchemy, Peewee, and the Django ORM.
Many object-relational mapping (ORM) libraries default to lazy loading for relationships. This pattern can be efficient when related rows are rarely accessed, but quickly becomes inefficient as relationships are accessed more frequently. In these cases, loading related rows eagerly using a
JOIN can be vastly more performant. Unfortunately, understanding when to use lazy versus eager loading can be challenging: you might not notice the problem until your app has slowed to a crawl.
nplusone is an ORM profiling tool to help diagnose and improve poor performance caused by inappropriate lazy loading.
nplusone monitors applications using Django or SQLAlchemy and sends notifications when potentially expensive lazy loads are emitted. It can identify the offending relationship attribute and specific lines of code behind the problem, and recommend fixes for…
Proper handling of money/currency is surprisingly challenging. This package adds money fields for Django forms and models.
A little Django app that uses
py-moneyed to add support for Money
fields in your models and forms.
- Django versions supported: 1.11, 2.1, 2.2, 3.0
- Python versions supported: 3.5, 3.6, 3.7
- PyPy versions supported: PyPy3
If you need support for older versions of Django and Python, please refer to older releases mentioned in the release notes.
Through the dependency
- Support for proper Money value handling (using the standard Money design pattern)
- A currency class and definitions for all currencies in circulation
- Formatting of most currencies with correct currency sign
$ pip install django-money
This automatically installs
py-moneyed v0.7 (or later).
djmoney to your
INSTALLED_APPS. This is required so that money field are displayed correctly in the admin.
INSTALLED_APPS = [ 'djmoney' ]
Use as normal model fields:
from djmoney.models.fields import…
Also from Ned Batchelder, the creator of the coverage package, a plugin for adding coverage.py to measure Django template execution.
Django Template Coverage.py Plugin
A coverage.py plugin to measure test coverage of Django templates.
Supported Python versions: 2.7, 3.4, 3.5, 3.6, 3.7 and 3.8.
Supported Django versions: 1.8, 1.11, 2.0, 2.1, 2.2 and 3.0.
Supported coverage.py version 4.x or 5.x.
The plugin is pip installable:
$ pip install django_coverage_plugin
To run it, add this setting to your
[run] plugins = django_coverage_plugin
Then run your tests under coverage.py.
You will see your templates listed in your coverage report along with your Python modules. Please use coverage.py v4.4 or greater to allow the plugin to identify untested templates.
If you get a
you need to set the
DJANGO_SETTINGS_MODULE environment variable.
The Django template plugin uses some existing settings from your
.coveragerc file. The
control what template files are included in the report.
Coverage.py can't tell whether a