Author archives: Daniel Schep, Digital Experience Consultant


Working with Mutually Exclusive Fields in Django Forms

By Daniel Schep, Digital Experience Consultant on Oct. 8, 2014 View Comments

Working with Mutually Exclusive Fields in Django Forms

Attention Django developers! When soliciting input from users with an HTML form, you want to design forms to be as flexible as possible. That means you build in multiple form fields to support multiple input options, even if you only want the user to fill in one of them.

Having two or more mutually exclusive fields in a form on a webpage/webapp is a pretty frequent scenario developers have to deal with. Unfortunately, Django's forms have no builtin support for this. In this blog post, I will cover the two simple, but ugly, solutions we Django developers often find ourselves using and introduce a library that makes working with such scenarios much simpler.

Read More