The current site is added correctly via the post_save signal and the tests are working fine for Template creation and updating via the shell, but when saved via a ModelForm (for example through the Django admin), instance.sites gets cleared shortly after again in form.save_m2m.
The current site is added correctly via the
post_save
signal and the tests are working fine for Template creation and updating via the shell, but when saved via a ModelForm (for example through the Django admin),instance.sites
gets cleared shortly after again inform.save_m2m
.This behaviour is analogous to what's described in Django Ticket 14649.