Regression introduced by r16739 -- `ManyRelatedManager.add()` doesn't commit to database
|Reported by:||Daniel Swarbrick||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Models are as follows (simplified):
class OrgUnit(models.Model): name = models.CharField(max_length=64, unique=True) description = models.CharField(_('description'), max_length=128) class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) favourites = models.ManyToManyField(OrgUnit, blank=True)
Following code does not work as it used to (in a view):
fav_list = request.user.get_profile().favourites orgunit = OrgUnit.objects.get(pk=13) fav_list.add(orgunit)
Immediately after the fav_list.add(), fav_list appears to contain the orgunit (cached), but it is not committed to the database (Postgres).
Reverting to r16738 restores the correct behaviour.
Change History (22)
comment:7 Changed 5 years ago by
|Severity:||Normal → Release blocker|
comment:12 Changed 5 years ago by
|Summary:||Regression introduced by r16739 → Regression introduced by r16739 -- `ManyRelatedManager.add()` doesn't commit to database|