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

How a Django Developer Can Write Speedy Unit Tests, Pt. 2: Fake it ‘Til You Make It

By Frederick Grim on Jul. 9, 2013 View Comments

This post is the second of a two-part series on writing fast and efficient unit tests in Python/Django. If you missed part one, be sure to start here.

At this point, a Django developer using Agile development methodologies will have a good handle on writing focused unit tests and your days of writing only integration tests for all of your features are long behind you. You stay aware of database transactions, and you employ agile software testing with read-only data in mind.

Read More