carljm/django-model-utils — pull request #76 by AngryLawyer (2013-08-23 16:17:13+00:00)
Title: Added Equality and Concatenation methods to Choices

In a recent project I worked on, I needed to be able to concatenate Choices objects - which turns out is a pain, as you have to unpack them. This code overrides __add__ and __radd__ to make it so you can just add them together, and also to other iterables that can be turned into Choices objects. I've also implemented __eq__, mostly to make unit tests involving choices easier.

I've written unit tests to prove all this works.

Cheers!

-Tony