1279 | | In [8670] a change was made to both `create()` and `get_or_create()` that affects people using manually specific primary keys on their models. There are two possible interpretations of what might happen if the key you passed into these functions already exists (in the case where the objects didn't already exist in the `get_or_create()` method). The previous behaviour was that, after the call returned, the data you passed in would always exist in the database and the object (and object with those values was always brought into existence). The side-effect here was that any existing row in the database with that primary key value was updated and this might have been unintended. |
| 1279 | In [8670] a change was made to both `create()` and `get_or_create()` that affects people in two ways: |
| 1280 | |
| 1281 | '''Firstly''', if you have a custom `save()` method on your model and it is going to be called using `create()` or `get_or_create()`, you should make sure you accept the `force_insert` parameter (best to accept `force_update` as well, just like `django.db.models.base.Model.save()`). You don't have to do anything with these parameters, just pass them through to the `Model.save()` method. |
| 1282 | |
| 1283 | '''Secondly''', if you are using manually specific primary keys on their models. There are two possible interpretations of what might happen if the key you passed into these functions already exists (in the case where the objects didn't already exist in the `get_or_create()` method). The previous behaviour was that, after the call returned, the data you passed in would always exist in the database and the object (and object with those values was always brought into existence). The side-effect here was that any existing row in the database with that primary key value was updated and this might have been unintended. |