Django save_model not being called on create
I just spent an hour trying to figure out why my save_model was not being called on the creation of a model but got called fine during edits. It's not like the save_model code was particularly complicated or anything like that. It was, in fact, about as simple as it got:
def save_model(self,request,model,form,change):
if not change:
model.created_by = request.user
model.save()
If this doesn't work, make sure you are developing against the latest Django version. A bug was reported and fixed 5-6 months ago, so you might already have the latest version, but make sure.
1.
Jeremiah Bertuzzi on July 24, 2010 at 01:29 am
<a href="http://skatelongboards.wordpress.com/"> Skate Longboards</a>