The Modell
instance isn't being saved when you add a new image; only the Image
instance is being saved.
Move your function call into the Image
model and you'll be good.
def on_image_saved(instance):
for img in Image.objects.filter(modell=instance.modell)
print img
class Image(models.Model):
modell = models.ForeignKey(Modell, related_name="images")
image = ThumbnailImageField('bilde', upload_to=get_upload_path_image)
class Meta:
verbose_name = 'bilde'
verbose_name_plural = 'bilder'
def __unicode__(self):
return str(self.image)
def save(self, **kwargs):
super(Image, self).save(**kwargs)
on_image_saved(self)