Posts tagged ‘django’


How to Build a Webhook Receiver in Django

Well, I’m hooked.

A common way to receive data in a web application is with a webhook. The external system pushes data to yours with an HTTP request.

Read more...

Using Django Check Constraints to Limit the Range of an IntegerField

Measure twice, cut out bad data.

Another way to use database constraints via Django’s CheckConstraint class.

Read more...

3 uses for functools.partial in Django

I am rather partial to a plant-scroll.

Python’s functools.partial is a great tool that I feel is underused.

Read more...

Disabling FLoC, Google’s new advertising technology

Birds of a similar browsing history FLoC together

Google has started rolling out FLoC, currently to 0.5% of Chrome users, and some sites are already disabling it. In this post we’ll cover what FLoC is, who’s disabling it, why, and how to do so on a Django site.

Read more...

How to set the new COEP, COOP, and CORP security headers in Django

“Where’s my coop?”

Here are three new security headers on the block:

Read more...

Introducing the heroicons Python Package

Only iconography can tell us what is going on here.

heroicons is a free SVG icon set for your websites, from the creators of tailwindcss. SVG icons are great - they’re small, they sit inline in your HTML, and you can scaled and colour them with plain HTML and CSS. And heroicons is a great icon set - minimal, clear, and consistent.

Read more...

django-feature-policy is now django-permissions-policy

This sheep doesn’t need permission to walk how it likes.

I created django-feature-policy in 2018 allow Django projects to control the draft security header Feature-Policy. Feature-Policy allows your site to restrict which origins can use some sensitive browser features, such as the the payments API or access to the webcam. This is valuable if you’re using any third party JavaScript. Whether such JavaScript comes from npm or an external script tag, you can protect against it doing some bad things with your users.

Read more...

How to convert a TestCase from setUp() to setUpTestData()

“Owl help you speed up your tests!”

Django’s TestCase class provides the setUpTestData() hook for creating your test data. It is faster than using the unittest setUp() hook because it creates the test data only once per test case, rather than per test.

Read more...

Using Django Check Constraints to Prevent Self-Following

This puppy would follow you anywhere.

Another way to use Django’s CheckConstraint class to ensure your data is valid. Based on my answer to a question on the Django forum.

Read more...

Improve your Django experience with IPython

Make your shell better

IPython is an improved Python shell for interactive use. It has many great features such as syntax highlighting, autocomplete, and powerful “magic commands”. I love it, use it on every project, and use the IPython prompt for examples on my blog.

Read more...

All tags: