anentropic/django-exclusivebooleanfield — pull request #3 by anentropic (2014-11-26 21:17:42+00:00)
Title: Issues/2 `on` ignored by migrations

Fix for issue #2

Will release as new version `0.2.0`.

Any migrations in your project created with earlier versions are broken if you rely on the `on` feature... you'll need to recreate or manually edit the existing migrations.

__For Django 1.7+ migrations:__
*****
Look for any `CreateModel`, `AlterModelTable`, `AddField`, `AlterField` operations (maybe others) ...anything where the definition of an `ExclusiveBooleanField` which should have an `on` kwarg has been serialized for the migration apparatus.

eg
```python
migrations.CreateModel(
name='ShorthandModel',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('value', models.IntegerField(null=True)),
('the_one', exclusivebooleanfield.fields.ExclusiveBooleanField(default=False, on=(b'value',))),
# add the `on` kwarg (IMPORTANT: use the tuple form) -------------------------^
],
options={
},
bases=(models.Model,),
),
```

__For South migrations:__
*****
(tested on Django 1.3-1.6 using South 0.8.4)
Since the state of the ORM is frozen as a big dict in every single migration file you're going to have to change in every migration since the field/model was added to your project.

eg
```python
'testapp.shorthandmodel': {
'Meta': {'object_name': 'ShorthandModel'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'the_one': ('exclusivebooleanfield.fields.ExclusiveBooleanField', [], {'default': 'False', 'on': "('value',)"}),
# add the `on` kwarg (IMPORTANT: use the tuple form) ---------------------------------------^
'value': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
},
```