Posts tagged "django"

Lacey Williams Henschel

How to Add Django Models to the Wagtail Admin

When working with Wagtail, you might find that you're using Wagtail Page models for some of your database models, but regular Django models for others. In this post, learn how to add your Django models to the Wagtail admin to make managing multiple types of models easier.

Lacey Williams Henschel

Using Different Read and Write Serializers in Django REST Framework

On a recent project, we needed to use different serializers for GET vs POST/PUT/PATCH requests to our API. Read on to learn how we used a mixin to accomplish this goal.

Lacey Williams Henschel

Tips for Using Django's ManyToManyField

ManyToManyFields confuse a lot of people. The way you relate objects to each other is just different enough from dealing with ForeignKeys and just uncommon enough in day-to-day Django development that it's easy to forget all the little tricks for dealing with them.

Flavio Curella

Pro-Tip - Slugs as primary keys

A very common pattern in a Django Project is to have some kind of 'model-type' relationship, where you have some kind of object that can only belong to one of the types defined in the database.

Lacey Williams Henschel

Today I Learned - Celery and Django and Docker: Oh My!

In this post, you will learn how to create a Celery task inside a Django project in a Docker container. Sounds awesome, right?

Lacey Williams Henschel

Today I Learned - A Brief Intro to Docker for Djangonauts

Lacey didn't have the opportunity to work with Docker at her last job. In this tidbit she steps you through getting started with Docker for Django developers.

Frank Wiles

Pro-Tip - Python: atexit

Python's atexit handler is one of those things people should use more often.  Some developers aren't even aware that it exists and that makes me sad. 

Frank Wiles

Pro-Tip - Python 12-factor apps with envparse

Getting your configuration from the system environment for your Python and/or Django apps is often the best way to provide security and flexibility. envparse makes it easy. 

Flavio Curella

Pro-Tip - reverse()'s soulmate resolve()

Have a URL but can't figure out what view it is supposed to use? Use resolve() to easily and quickly determine it just as Django does.

Jeff Triplett

Pro-Tip - Extend Django Templates Smartly

You can use a variable to set the name of the template you are extending when using Django templates.