Django field with automatic values swap
Uniform number in sport team.
Race number in an athletic competition.
Any scenario when you want to swap values without reordering.
Current status allow swap values if not exists unique/unique_together restriction. First, get the registry (if exists) what contains the new value to assign it the old value from registry what currently is saving. When current registry is saved, replace the other registry with old value.
In next versions, other method will be used when exists unique/unique_together restriction.
[ ] Two or more django-swapfield in the same object.
[ ] Alternative method when exists unique/unique_together restriction
[ ] Friendly validation error with Django Admin (no Fatal error)
[ ] Abstract django-swap-field
[ ] SwapCharField
[x] Tests for functionality
[ ] Tests for migrations
[ ] Config setting to choose swap value when a new record (not edited) get a value that exists in database: choose the max value +1 or the first available.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.