What I am trying to do is execute a function after model is saved. For eg: when I upload a db dump file through admin, i want to load it that time to db.
I tried following thing by overriding save function:
class DumpFile(models.Model)
file = models.FileField(upload_to="dump")
def save():
super(models.Model,self).save()
<LOAD DUMP LOGIC>
Here it is giving attribute error super has no attribute save().
I don’t understand what is the problem there. Please let me know this problem or about any function which works after models are saved.
superis supposed to be given the current class, not the parent class:Also, look into signals, which are another mechanism for making things happen after standard Django events.