1
votes

I want to add a BooleanField to an existing model, with default=False and that all already existing objects in my table get a True value in that field.

This is: I want all my existing objects to have my new attribute on True, but from now every new object has this value at False by default.

I tried rolling back my migration, setting the "keep_default" on True, migrate again but it didn't work.

Thanks

1

1 Answers

0
votes

Add the new field with default=False, create the schemamigration as usually --auto and run it, then code a datamigration for changing the value to True for all existing objects and run it, that is all :D