Django

23 posts

My appearance on the Django Chat podcast

Django

Django: Customizing how a model form renders fields

A quick look at providing a custom HTML template for ModelForm to use for fields you choose.

Django

How to calculate contrast color in Python

Using luminance to get contrasting foreground colors for the user-selectable background.

Django

Django: How to let user download a file

Creating file download links with the help of a FileResponse.

Django

Django: How to send email without Celery

Lightweight emails without Celery. And without a request-response cycle.

Django

Django tip: Redirecting straight from urls.py

You don't need custom view to redirect URLs.

Django

Creating dynamic RSS feed with parameters

Quick look at setting up RSS feed that takes a parameter.

Django

Django Waffle: Quick intro for dynamic feature toggling

I have recently discovered the power of Django Waffle. This is the quickstart tutorial I wish I had.

Django

How to use elided pagination in Django and solve too many pages problem

Since Django 3.2 there is a way to handle big pagination with large number of pages.

Django

How one default parameter almost killed our servers

A short story about serious server issue caused by super minor thing.

Django

Django Gems

Django Admin tip: Auto-generated slug content

With a single line you can save yourself the trouble of filling in the slug manually.

Django

Django Rest Framework

How I built API for iOS Feeds in 10 minutes

Just a short look what is possible with Django Rest Framework.

Django

Working with Django ImageField

My notes for smoother working with this model field. Saving using model forms, Image, deleting and resizing.

Django

How to setup Postgres locally for Django on Mac

The easiest way to have local instance of PostgreSQL on your macOS system available for your Django projects.

Django

Django Gems

Hidden gems of Django: Truncator

Turns out Django offers great way to truncate text. Lets see how to use the built-in util Truncator.

Django

How to select random record with Django ORM

This post details how I solved displaying random banner on this very site. The solution does not have any prerequisites.

Django

How to automatically switch debug/production database in settings.py in Django

Since settings.py is just an ordinary Python file we can use simple `if else` block.

Django

How to display fractions in Django

Short post about rendering for example 1/4, 1/2 and other fractions in your Django template. Turns out this is not complicated if you know about important parts to combine.

Django

How to create RSS feed with HTML content in Django

Presenting my solution which I arrived at with trial & error in hopes it could save time to someone.

Django

Django Rest Framework

How to create/register user account with Django Rest Framework API

My solution for account registration with DRF.

Django

Django: How to send image file as part of response

Using Base64 might be useful in some scenarios.

Django

Django Rest Framework

Django Rest Framework: How to let user add only one ForeignKey object (for example review)

My solution I decided to write up to have reference in the future.

Django

Django: How to let user re-order/sort table of content with drag and drop

I needed to preserver order of table elements and decided to share my solution.

Django